3 ms·
If the requestor only knows the filename, now you have to cache the filename to hash lookup. Then you've just moved the invalidation problem around. This is a
by ben509 6y ago
If the requestor only knows the filename, now you have to cache the filename to hash lookup.
Then you've just moved the invalidation problem around.
This is a great strategy if the object is controlled by a build process, so your client code already knows what the hash is.
- jrochkind1 6y ago> Now you have to cache the filename to hash lookup. The OP's "Strategy 4" is basically exactly that, although they describe it a bit confusingly as "namespacing" assuming a sort of hieararchy that we don't have here, without realizing it's more general purpose. The OP acknowledges that in Strategy 4 "Each logical cache lookup now requires two real lookups - first for the namespace key [in our example lookup the filename to get the digest] and then for the actual key [use the digest to look up the actual content]" I have more commonly used it when you can have the digest at the ready though, when you can make the requester aware of the digest. The "build time" doesn't necessarily have to be the software build time; I have sometimes put the digest in the database (which the requester has access to, and where it's cheaper to access then the entire content would be), which can then be used to fetch the content from the "cache". I guess this really is two cache lookups across two cache products, considering the database as a cache in that case, but sometimes the database fetch is going to happen naturally anyway.