Reputation: 332
I have reviewed the documentation of CI regarding caching a full page here: https://www.codeigniter.com/user_guide/general/caching.html
I understand that I can cache a controller/function using the below; anywhere inside that function:
$this->output->cache($n);
However my problem is that for example we have a page:
article/specific/this-is-a-slug
as you can see the
When I cache the function inside itself, the system automatically detects that slug and creates a new cache for each slug uniquely.
However when I want to delete the cache for that specific slug I do not know how I can do it outside the function itself:
$this->output->delete_cache('/foo/bar');
How can specific that I need only the cache for this specific slug to be deleted?
Upvotes: 1
Views: 4987
Reputation: 178
You can do it wherever you wish, as long as you know the URI. The string in the delete_cache
is the URI.
$this->output->delete_cache('/article/specific/this-is-a-slug');
Caching can be enabled on a per-page basis, and you can set the length of time that a page should remain cached before being refreshed.
Upvotes: 1