CodeIgniter Forums
Caching Question - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Caching Question (/showthread.php?tid=90893)



Caching Question - lazcorp - 05-19-2024

I'm using file caching to cache some of my pages, and it's working well - I'm simply using a line like this in each relevant controller. 
PHP Code:
$this->cachePage(DAY); 

I want to implement an Admin panel that lets me delete the cache for a specific page, but I can't work out what CI4 is using as the key. I've tried the md5 hash of the full URL of the page (e.g. https://www.example.org/blog/a-specific-blog-post) and also just the path (/blog/a-specific-blog-post), but neither seems to be the value being hashed.
How do I generate the key for a specific cached page so that I can then use the delete($key) method of the Caching Driver to delete the cache for that page?


RE: Caching Question - ozornick - 05-19-2024

See https://github.com/codeigniter4/CodeIgniter4/blob/8fc89854cc85c3b002ce2b26d5de56f6fa131166/system/Cache/ResponseCache.php#L74