Hello,
I’m sorry but I’ve been looking around and I haven’t seen a way to clear the cache for a specific page, something like this:
$page->cache()->remove()
or
$kirby->cache('pages')->remove($page)
Is there such a thing?
Many thanks
Hello,
I’m sorry but I’ve been looking around and I haven’t seen a way to clear the cache for a specific page, something like this:
$page->cache()->remove()
or
$kirby->cache('pages')->remove($page)
Is there such a thing?
Many thanks
Since often changes to one page affect not just the cache for that page but other pages as well, we rather flush the whole cache usually. If you really want to handle just one specific page’s cache, you could look at reimplementing Page::cacheId()
to get the cache’s key for the page and then do something like $kirby->cache('pages')->remove($key)
.
Is there a special way to clear the cache?
Can I delete it from a template?
$kirby->cache('pages')->flush();
This doesn’t work for me.
Thanks
Are you sure your issue is being caused by Kirby’s caching system, and not by something like your browser’s cache, or some other caching mechanism that might be active on your server?
Is caching turned on, and the cache driver type specified in your config? If so, and you are using one of the four built-in cache drivers - file
, apcu
, memcached
or memory
- then the flush()
method should work.
Yes I have all of this. I don’t know what was happened because I tried different things (one of those update from 3.7.1 to 3.7.5) and now it works.
Thanks