(Links are fine, of course)
(Links are fine, of course)
Now all you need to do is to ensure that whenever an object or its children change, you update their timestamp (the "touch" part), and if you make a changes to the code, you increment the version key for said cache piece. This way new requests will not hit old cached content.
How does the application learn which version an element is at right now? Don't you have to call the database to find out?
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.