Delete Objects based on REGEX.

dormando dormando at rydia.net
Thu Jul 26 08:17:04 UTC 2007


How do tags help when a developer runs over, saying something about 
expiring all keys with the word 'whifflebat' in the middle?

Or, I guess, is the idea of tagging more about not using key prefixing 
at all anymore? That'd be swell, but I think that would be the two camps 
of thought here.

Tags) Requires planning
Regex) Pragmatism

Maybe there's a way to do both without duplicating tons of code? :)

-Dormando

Steven Grimm wrote:
> I actually implemented regex deletes quite some time back. But the 
> problem is that I did it in a brute-force way, nothing elegant or 
> efficient, and if you have a large cache the whole thing will freeze up 
> for many seconds, chewing 100% of your CPU while the code walks through 
> all the items comparing them against the regex. We wanted it for very 
> occasional administrative operations where the cache freezing up for a 
> short while would be less disruptive than a full flush, but I think 
> we've used it maybe two or three times at most because it's so nasty.
> 
> Brad's generation-based idea makes much more sense as a long-term 
> approach to this feature, but honestly I like tags a lot better. I'd 
> rate tags a 10 and regex deletes, even well-implemented ones, at most a 
> 6 or 7 because they're so inflexible and require that all consumers of 
> objects in the cache be aware of all the metadata you can use to address 
> a particular object (because it's all part of the key and you need the 
> whole key to query the cache.) Tags are IMO far superior because you can 
> tag an item with metadata that some of your clients are blissfully 
> unaware of.
> 
> -Steve



More information about the memcached mailing list