Programming: Caching
From wikinotes
Invalidation
Tag Caching
Objects are assigned an auto-incrementing version number
When an object changes, the cache is updated with that version number
Caches that refer to multiple object-types, keep a reference to the versions of each object the cache refers to.ex.
- User created
user_v=0
- User renamed
user_v=1
- ProjectUsers
adds user proj_v=1
- ProjUserCache is tagged with
user_v=1,proj_v=1
When a request is made to the cache, user/project versions stored in cache are verified as being up to date, and the cache entry is either used or expired.
NOTE:
this feels like it has an atomicity problem...