2 ms·
when you cache some html wich depends on $some_object, use a key that includes that object "version" (e.g. a timestamp). Then on first access you save the html
by riffraff 15y ago
when you cache some html wich depends on $some_object, use a key that includes that object "version" (e.g. a timestamp).
Then on first access you save the html for a key "object-x-v1" and on subsequent access you get the same html.
When the object changes (v=2), so will the key ("object-x-v2), and when you access the same content again you will have a cache miss and the html will be regenerated, while the stale cache will just stay in memory until it's naturally evicted from memcache.
- Sujan 15y agoGot that, follow up question here: http://news.ycombinator.com/item?id=3609369 http://news.ycombinator.com/item?id=3609369