Delete cache entry

Is it possible to delete a single cache entry?
I’m using $cache->save($cache_id, $cacheoutput); to save cache, and I want to be able to delete specific cache entries. (Deleting all cache is far to expensive on resources)

I tried: $delete = $cachedriver->delete($cache_id);
It returns true, but the specific cache keeps being served. (I’m using simple filesystem cache)

Any thoughts on how to implement this if not available?

Solved it by using:

$cachedriver = $this->grav[‘cache’]->getCacheDriver();
$cachedriver->save($cacheid, $cacheoutput);

instead of
$cache = $this->grav[‘cache’];
$cache->save($cacheid, $cacheoutput); to save cache

I can then delete it using:
$cachedriver = $this->grav[‘cache’]->getCacheDriver();

Yup, you worked it out already :slight_smile:

We hope to bring some smarter cache clearing strategies to Grav this year. It’s a bit more complex than it sounds because there are implications of a config change having an effect on all pages. but a simple page change should be smart enough to update only that page.