I have a landing page which lists out all it’s children’s content on it. This page requires a user to be logged in to view, so I can’t cache the landing page as a whole. Is it possible to cache only the portion of the page which lists out the children? I am noticing it’s a little slow, so hoping to avoid iterating over children on the fly.
Unfortunately I can’t answer your question directly, but this topic may help you: Cache part of a page?
Thanks, that worked great. I used a snippet in order to fetch the contents which would be stored in the cache.
$cache_key = 'portfolio';
$portfolio = cache::get($cache_key);
if (!$portfolio) {
$portfolio = snippet('portfolio', array('site'=>$site), true);
cache::set($cache_key, $portfolio);
}
It is important to pass the $site
variable into snippet, otherwise it doesn’t seem to have access to it yet.
2 Likes
Great. Thanks for sharing your solution.