Listing all keys on a server: why?
brianm at dealnews.com
Thu Jul 27 18:57:49 UTC 2006
> I think a lot of that comes from the lack of namespaces in memcached.
> You can't just say 'invalidate all cache entries for user jsmith.' So,
> an obvious way to work around it is to get a list of active keys, run
> through them looking for anything that matches 'jsmith' and delete it.
I know it seems hacky, but this works for us quite well:
user = "jsmith"
key_salt = get(user."_salt)
// get user
key = "user_data_".user."_".key_salt
user = get(key)
// delete all jsmith cache
If you need several salts, just have a few that are loaded on an as
needed basis in a static or global var depending on your language.
Its good to be cheap =)
More information about the memcached