Thanks for the reply.
keys 1..3 are unique for id, means for several requests generated by
particular id. BTW in *key1->id, *by id you mean value of key. right?
What I meant by that phrase is that if i store *id:value* once and again
for next request by same or diff id I'll have to add again *id:value2. By,*
doing
this I'll override the previous value. I think I'll have to store like:
id1->full struct
id1key1->val
id1key2->val
id1key3->val
id2>full struct
id2key1->val
id2key2->val
id2key3->val
Correct me if I am wrong. May be I am missing something in concept.
Thanks.
On Thursday, September 10, 2015 at 1:06:01 AM UTC-4, Denis Samoylov wrote:
>
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.