Welcome Guest, Not a member yet? Register   Sign In
Cached files getting deleted in bulk before expiration
#1

[eluser]Unknown[/eluser]
All of my cache files are getting deleted within seconds of being created. I checked cron to make sure I didn't have an old job that was removing them and no issue there. I'm using the standard "$this->output->cache(5);" method. I also commented out the return return unlink($this->_cache_path.$id); and delete_files($this->_cache_path); lines in system/librarices/Cache/Cache.php in an effort to track what method may be getting triggered. But they still all get delete within just a few seconds regardless of the setting. It it's all files that get deleted in the directory. Any ideas? Thanks in advance for your help?
#2

[eluser]CroNiX[/eluser]
Very strange. Do the cached files get removed by themselves without you hitting the url for the cached page again in the browser? Like you visit a particular page once and then view the /cache dir, and see the new cache file there but the file just disappears by itself without doing ANYTHING at all?

If you view one of the cached HTML files, does it have the timestamp correctly inserted at the very top of the document before your regular HTML, like:
Code:
1404511152TS---&gt;<!doctype html>

There's nothing in CI that would remove a cache file unless it's expired, and it will only do that when you access a page via the browser that has an expired timestamp in the existing cache file.

The only other thing I can think of is to check the value of the timestamp and see what time it says it was created. It could be that a date setting such as timezone is not correct and it's creating a timestamp in the past instead of the current date/time. But again, that would only delete the cached file if you hit the URL again and not by itself.

#3

[eluser]Unknown[/eluser]
Quote:Very strange.  Do the cached files get removed by themselves without you hitting the url for the cached page again in the browser? Like you visit a particular page once and then view the /cache dir, and see the new cache file there but the file just disappears by itself without doing ANYTHING at all?

Hard to tell because of the outside traffic coming in. But it seems to fill up then when I refresh the dir after 30 seconds or all files are gone and start getting rebuilt.

Timestamp looks fine as it relates to the clock on the server.

I do have the output class extend to help with caching admin features (or better put to avoid having the admin controls show up to non logged in users. ) see attached.

I also noticed that if I create a new cache folder (eg cache_mine), and point to it in the config it works just fine. So far now that's my fix Smile. Thanks for the help.




Theme © iAndrew 2016 - Forum software by © MyBB