Hacker News new | ask | show | jobs
by macca321 1006 days ago
About 15 years ago I implemented "cache namespacing" for memcached, where you build a final cache key for a stored item (e.g. "profile_page") by doing an initial multiget cache query for all the "namespace" version values (e.g "user_123", "team_456" might be needed for "profile_page"), which you combine together as a prefix for the final cache key.

You can then invalidate any final cache key that uses one of the namespaces by incrementing the namespace key.

I haven't come across this technique mentioned elsewhere since, but it's very useful.

See the namespaces section in the now 404ing memcached FAQ https://web.archive.org/web/20090227062915/http://code.googl...

I guess nosql, edge caching and materialised views make it less applicable than it used to be (when inelastically scaling single/replicated SQL instances were the only game in town and taking load off them was vital).

Or is this technique now a first class feature of various cache client SDKs?

1 comments

Edge caching often has to support purge-by-tag which ends up working similarly.