Re:Tobias Lutke still writes code for Shopify
by ehnto on Thursday November 05, 2020 @10:52PM
(#25004720)
We call them cache keys. We use a hash of entirely arbitrary data you want a cache item to invalidate on when that data changes.
For example, a cached snippet of HTML for a related products section should invalidate if the product IDs change, so you hash the Item ID with the product IDs and bam, you got a cache key that will let you know when you need to reprocess that snippet.
Put that bad boy as a child of another snippet and you can cache the whole lot. It's cache keys all the way down!
Caveat: not worth the engineering effort for simple systems, just use an FPC and call it a day.
For example, a cached snippet of HTML for a related products section should invalidate if the product IDs change, so you hash the Item ID with the product IDs and bam, you got a cache key that will let you know when you need to reprocess that snippet.
Put that bad boy as a child of another snippet and you can cache the whole lot. It's cache keys all the way down!
Caveat: not worth the engineering effort for simple systems, just use an FPC and call it a day.