Using Russian Doll Caching
Fragment caching is very nice, but it has a pretty heavy drawback. Take the view you just improved: as it currently stands, it’s enormous, containing a lot of content from thousands of different films. An update on any of the films will expire the cache of the whole fragment, forcing it to reprocess everything. And all that when only a very small piece of the whole response has been modified!
Fortunately, there is a better way. You can break the contents of this huge view into smaller ones that will be cached individually. This is appropriately called Russian doll caching. Like Russian dolls, you can have cached content inside cached content: when the bigger cached content expires, you just move to the smaller pieces ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access