CodeIgniter Forums

Full Version: Output cache not deleting expired caches
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've got an issue in that expired page caches are not being deleted. This is currently happening under v3.1.9 but I've also noticed on some of my old v3 applications it's doing it as well.

On https://www.codeigniter.com/user_guide/g...ching.html, it states that expired caches should be deleted before being refreshed.

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

Is there something special I should be doing?

I've also noted it talks about having to manually delete cache files if configuration options are changed.

Quote:If you change configuration options that might affect your output, you have to manually delete your cache files.

Is there a more in-depth explanation of what configuration options could be changed that would require manual deletion?
The behavior is supposed to be that cache files are deleted when a requested page has a cache that has expired. Understand that the deletion mechanism only applies to the specific page request. The deletion process doesn't walk through all the cache files and delete all the expired ones.

Do you use the following?

PHP Code:
$config['cache_query_string'] = TRUE

If you do, then any variation in the query string will result in another cache file for that exact combo of URL+ query parameters. If that exact combo of URL+ query parameters is never requested again the cache file will never be deleted.

The config options that will affect cache behavior are

PHP Code:
$config['cache_path']
$config['cache_query_string']
$config['base_url']
$config['index_page'

Basically, all of the above affect the name of the cache file. Change any of them and existing cache files are instant orphans.
I do have cache_query_string set to true but maybe I need to look at my app not caching the page where query strings are used.