Getting straight to the point -- this would be a good start. https://github.com/memcached/memcached/blob/master/items.c#L88-L216
On Fri, May 10, 2013 at 6:27 AM, Nicola Licheri <[email protected]>wrote: > Hi. > For my thesis, I'm working on a fork of Memcached, a C++ reimplementation > without libevent. > To do this, I need to know how Memcached use items to store key and > values. > Particularly, I'm interested to know in detail what each field is used > for. > > The item type has been defined in memcached.h as > > typedef struct _stritem { > struct _stritem *next; > struct _stritem *prev; > struct _stritem *h_next; /* hash chain next */ > rel_time_t time; /* least recent access */ > rel_time_t exptime; /* expire time */ > int nbytes; /* size of data */ > unsigned short refcount; > > uint8_t nsuffix; /* length of flags-and-length string */ > uint8_t it_flags; /* ITEM_* above */ > uint8_t slabs_clsid;/* which slab class we're in */ > uint8_t nkey; /* key length, w/terminating null and padding > */ > /* this odd type prevents type-punning issues when we do > * the little shuffle to save space when not using CAS. */ > union { > uint64_t cas; > char end; > } data[]; > /* if it_flags & ITEM_CAS we have 8 bytes CAS */ > /* then null-terminated key */ > /* then " flags length\r\n" (no terminating null) */ > /* then data with terminating \r\n (no terminating null; it's binary!) */ > } item; > > Can you explain to me how populate each field of this structure to memorize, > for example, key = "mickey" - value = "mouse" ? > > Thanks for helping me! > Nicola > > -- > > --- > You received this message because you are subscribed to the Google Groups > "memcached" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- --- You received this message because you are subscribed to the Google Groups "memcached" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
