Codeigner cache files are not deleted

I am trying to use Web Page Caching with CodeIgniter. Its Docs says about generated cache files:

If it has expired, it will be deleted and refreshed before being sent to the browser.

But I noticed that expired cache files aren't deleted, and my cache folder continues growing up.

How could I fix this situation (maybe without a cron job which removes cached files)?


The cron job you suggested is the most efficient. Do you really want to slow down the user experience by forcing them to glob() through your cache?

You can run a hook which detects if the user agent is a robot, and delete old files in that case, but be careful which bot you run it for or you could end up with some "this page is slow" results on random websites. :)