key collisions

Steven Grimm sgrimm at facebook.com
Thu Jan 11 06:24:56 UTC 2007


Are you caching more than one table? If you're using a simple numeric 
key to identify each row, do the IDs overlap? (I.e., is each table's set 
of primary keys assigned independently?) If so, you'll need to include 
an object type as well as the row ID.

But why are you bothering with the md5, if you already have a unique key 
for the data you want? Why not just use the DB key as the memcached key?

-Steve


mark wrote:
> Hi
> I am consistently getting key collisions. There are total of around 
> 2000 key value pairs cached.
> This is how I prepare the key for memcached: md5.new(key).hexdigest() 
> where key is the unique
> id for the database row that I want to cache.
> When I do a 'get' for a specific key, I get a value of a different key.
> I am using python-memcached as the client.
> This is causing lot of problems. If anyone has faced similar issues or 
> has any suggestions do reply.
> cheers
> mark



More information about the memcached mailing list