This week in caching: cache-key design as an art
The key decides your hit rate before any TTL does:
— Cardinality budgeting — every dimension you add (device, locale, query param) multiplies your key space; how to count the blast radius.
— Canonicalizing query strings — sorting params and dropping junk so ?a=1&b=2 and ?b=2&a=1 share a cache entry.
— Hashing vs readable keys — debuggability vs length trade-offs in Redis/memcached namespaces.
— Versioned namespaces — prefixing keys with a schema version so a deploy 'invalidates' everything by simply changing the prefix.
Credits: the Fastly cache-key docs and Nick Craver's Stack Overflow caching posts.
Bookmark: the versioned-namespace trick — invalidate-by-rename, the laziest correct flush there is.
Cache Catch
@CacheCatch
This week in caching: cache-key design as an art
Этот пост опубликован в Telegram-канале Cache Catch. Подписаться можно по ссылке: @CacheCatch.