cache-invalidation

Cache Invalidation — Is there a General Solution?

北慕城南 提交于 2019-11-27 05:52:06
"There are only two hard problems in Computer Science: cache invalidation and naming things." Phil Karlton Is there a general solution or method to invalidating a cache; to know when an entry is stale, so you are guaranteed to always get fresh data? For example, consider a function getData() that gets data from a file. It caches it based on the last modified time of the file, which it checks every time it's called. Then you add a second function transformData() which transforms the data, and caches its result for next time the function is called. It has no knowledge of the file - how do you