I have a very specific cache situation. We use several solutions for caching and I wonder what is the best solution to invalidate the cache on a user action.
The cache is like so
First layer: CDN caches the full page as HTML for logged-out users
Second layer: full page cache in memcached for logged-out users the reason I have the second layer is to respond to edges, sometimes not all edges are cached, so I want to "answer" the edge from cache as well.
Third layer: cache HTML partials and database data for logged-in users.
My problem is that my invalidation process is very much based on the third layer right now, and I don't answer the second and first layer well enough.
My question is: what is the best way to invalidate the cache on the full URL from a cache key that has absolutely no coupling with the URL? For example, if I have a trip plan, inside the trip plan there are comments, I want to invalidate the full page trip plan URL when a user comments with a new comment.
Comment model has no URL, and the "parent" also doesn't have the URL, the same comment will also apear in the city page, so it's completely a reusable object and partial.
I read some blogposts by David Heinemeier Hansson on the 37signals blog.
Their take on the problem is to cache all the different objects on the page and then use CSS and JS to customize the view.
It may not solve your problems but with the description you gave i think it might at least give you some tips.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With