Protcol Additions

Fabian Thylmann fabian at toomuchmedia.com
Thu Nov 17 03:17:37 PST 2005


Hi,

I would like to discuss additions to the main protocol of memcached to 
allow two things:
1) wildcards in keys to get requests
2) wildcards in keys to delete requests

I know the first reply that I would get to this kind of message on this 
list would normally be "memcached is not a database" but let me explain 
why I think these additions are usefull.

We write affiliate management software and are currently adding support 
for memcached throughout the system. Our system is extremely 
configurable allowing the admin to set different commission structures 
based on the site, option of the site and affiliate. I cache these 
payout options in memcached to not have to query from the database 
constantly since I need them very often. I use a key like this:
payout_SITEID_OPTIONID_AFFILIATEID

Now, if I had 5 sites, 2 options per site and 1000 affiliates that would 
be 18018 different keys right there (they could all be 0 also to use the 
default).

In the worst case, if an admin changes the base payout I would have to 
go through all possibilities to delete the key from memcached, I do not 
want to let them expire because the changing of payouts does not happen 
often so it makes more sense to delete the keys when they are changed.

If I had a wildcard for delete requests, this would be a lot easier to do.

There are similar scenarios where I would like to be able to get for 
example all optionids' payouts for a specific siteid so get would need 
wildcards too.

Right now what I do when any payout is changed is I send a flush_all to 
clear the whole cache. This of course works but it would be great if it 
were possible in a different way.

My guess though is that due to the way to keys are found normally a 
wildcard would slow finding them down a lot, is that correct?

Fabian


More information about the memcached mailing list