memcached invalidation based on values
Is it possible to invalidate memcahced
entries based on va开发者_开发百科lues.
memcached
.
key = userID
value = groupID
So multiple userIds
map to one groupID
.
When I delete a particular group then I want to remove all entries in memcache
store which have value as the groupID
of the deleted group.
So Essentially I want to delete the entries having particular values. How do I do it.
You cannot get key's by value in memcached. What you could do though is have a key called groupID that has a comma separated userID's. If you want to see who is part of a group then you could get the key called groupID and parse out the userID's. Then if you have a key for each userID you could delete them with the parsed userID's. You could use memcached's append function too to just append the userID's to a groupID key when a new user registers for you system.
I wrote a blog post on maintaining a set a while back that may do what you're looking for.
It's essentially what mikewied is suggesting, but with more words and code samples.
精彩评论