Object aliasing support in memcache?
dormando at rydia.net
Sat Aug 25 03:28:35 UTC 2007
If you're using multiple memcached's (which you should!), you'll have an
issue with each of your keys possibly resolving to different servers.
There're some tricks around that, but I don't believe they apply to your
http://lists.danga.com/pipermail/memcached/2007-July/004528.html - using
your own 'hash' value to improve locality).
You want to look up a user's profile in not via their unique user id,
but by two separate lookups. Instead I'd recommend doing an extra round
trip and looking up the "userid" via whatever you have (uhh, something
other than SSN?), then look up the profile with the userid.
If you're doing a lot of other lookups early on the process, you can do
some batching to reduce the issue of the extra round trip. As long as
going to memcached is still quicker than looking up via fallback methods.
allan zhang wrote:
> For example, I want to store a guy's profile into memcache, if I can get it
> either from SSN or name+birthdate, it will be great. Otherwise, I have to
> map one key to another key (one more table is needed) then get it from
> memcache. Storing two object by two different will even not be considered
> since duplication will cause consistency and storage issue.
> Another example is from our planned project:) but can not give details
> On 8/24/07 12:56 PM, "Josh McFarlane" <josh.mcfarlane at gmail.com> wrote:
>> On 8/24/07, allan zhang <azhang at yahoo-inc.com> wrote:
>>> does anyone have implemented object aliasing in memcache? I mean, we can
>>> use multiple keys to point to same data object, similar to the link in file
>>> system. I hope the implementation is made in memcache itself.
>> Can you provide a scenario where this provides any additional benefit?
>> It seems to me in all the cases that I can think of that you could
>> just do it on the client side (in your own custom code that is)
More information about the memcached