store four key-value pairs: id->full struct key1->id key2->id key3->id
i hope keys(key1..3 are uniq) so, storing will be one op with four values and retrieving will be two ops get key and than get id i still think i miss something because of this phrase "I guess no because duplicate keys are overridden in hash tables" :) On Tuesday, September 8, 2015 at 9:13:05 PM UTC-7, Suryaveer Chauhan wrote: > > Hi All, > > I am a new user for memcached and related products so pardon my > understanding. > > I am working on a *C code* (not written by me) which has a caching > mechanism builtin to the code. Now, we want to move it outside into > memcached or some other cache. What I understand from the code is that they > have used some custom hashing technique. I'll explain below: > > struct A > { > field id; > field key1; > field key2; > field key3; > field othervalues1; > field othervalues2; > field othervalues3; > A next; > } > > struct hashtable > { > struct A; > lock; // to lock the bucket > } > > When inserting into the hashtable a *hash is calculated using field id *and > bucket is decided. Then insert as usual (whole struct is cached), create > linkedlist for collisions. While > retrieveing same procedure is repeated but the entry is *searched using > the **key1,2,3 *and the bucket is locked too. > The idea I guess is to keep all the entries for same id under same > bucket. This means it stores duplicate keys. I don't know exact intent > behind this. > > Now, my doubt is, can I get same behaviour in memcached and for that > matter any other cache tools like redis. > > I guess no because duplicate keys are overridden in hash tables. The > simple approach would be to have key1,2,3 as key or may be id also. > > So, if this is not possible I request to please guide/suggest me how can I > achieve something similar to this in memcached. > > Thanks, > Suryaveer > -- --- 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 memcached+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.