HTTP caching solutions such as Varnish are great for improving web application performance. Filling up the cache is easy, but how do you get rid of cache entries when they become stale? There are three ways: expiration, validation and invalidation. The first two are nice and simple, but have their limitations. The other option, invalidation, is frowned upon for its complexity. Still, it can be very useful. Case in point: an e-learning web platform we built that serves a large number of Dutch pupils and their teachers. I will tell you why and how we added an invalidation scheme to this platform. I will also show you our lightweight Symfony bundle that makes cache invalidation a little less complex.
8. Back to caching models
Quick
refresh
Don’t talk
to Symfony
Expiration
×
✔
Validation
✔
×
Invalidation
✔
✔
9. “There are only two hard things in
Computer Science: cache invalidation and
naming things.”
– Phil Karlton
10. “You should never need to invalidate
cached data…”
“Actually, all reverse proxies provide ways
to purge cached data, but you should
avoid them as much as possible.”
– Symfony2 documentation