libmemcache - custom structures

Jure Petrovic fonz at siol.net
Fri Dec 8 14:51:03 UTC 2006


Hello,


How would I be able to store a custom structure like with libmemcache:

typedef struct person {
        char name[50];
        int age;
} person;


I've tryed something like:

mc_set(mc, "obj", sizeof("obj"), &one, sizeof(person), 0, 0);

which doesn't return an error. But I do get an error when trying to 
retrieve the same structure:

void *res = (person*)mc_aget(mc,"obj", sizeof("obj"));

[FATAL at 1165588421.967543] mcm_fetch_cmd():1305: memcache(4) protocol
error: ERROR


Does this mean, that I will have to do the serialization?
Any suggestions?


Regards, 
Jure Petrovic



More information about the memcached mailing list