Welcome Guest, Not a member yet? Register   Sign In
HUGE application cache

Hi there,

I am about to take over a CI project, and as I start to learn CI, the first thing I noticed when looking through the files is that the application/cache folder has 25 GB of cached files (!), taking up an enormous amount of space on the server. My question is if it is safe to remove all of these files as a short term fix until I can learn CI and make a cron to keep this folder at a manageable level?

I notice the folder also contains an index.html file and .htaccess file. If I clear the whole folder out, do I need to leave these 2 files or is it not necessary? My hosting provider say they can clear this whole folder for me (my command line skills are not up to much), but I did worry about the index and htaccess. Any pointers greatly appreciated. The issue is that as a result of this huge use of disk space, the server is close to reaching its limit, which is why I am looking, short-term, to free up disk space. When I get stuck into CI, I hope to find some better solution to avoid such a buildup, so again, any suggestions about how to approach this would be welcome.



Can you give us a little more information. What version of CI are you using (2.x or 3.x or 4.x)? DB?

Many thanks for getting back to me so quickly. The CI version is 2.1.0 and the database is MySQL (Server version: 5.7.34 - MySQL Community Server (GPL)). Appreciate any suggestions.

Apologies. The actual live server versions is 3.1.6 - I was looking at an archived version by mistake.

(This post was last modified: 04-22-2021, 08:17 AM by craig.)

It depends on the code that generates or uses the cache entries, but they're supposed to be OK to delete; applications shouldn't rely on the cache as a permanent data store.

Usually, caches are a result of doing something that takes time to do (so you don't have to do it every time you need the same result). If you delete the cache files, those tasks will need to run fully, and are likely to generate new cache files at the time (if the cache library is turned on).

If those functions that take time to run no longer work properly, or called out to external services that are no longer active or available, then some things might not work.

Your safest option would be to find all instances in the code that uses the cache, and determine if it's safe to delete the files that match that usage.

The quickest option would be to delete the cache files and hope for the best.

Whatever you delete, it's recommended to keep the index.html and .htaccess files.

Hi Craig,

Much appreciated. The site does have some calls to external services (Facebook widgets, a weather api, possibly others), and it is possible that some of these version may be out of date or no longer available, so I will try to take a closer look before pulling the plug on the cache files...

I will also see if I can quickly set up a copy of the site on my localhost and see if the site basically runs OK with the cache files removed, as a simple test.


As a follow-up, after checking on localhost that clearing the cache caused no ill effects, I was able to get this done on the live server successfully - 25 GB of cache files waved goodbye, without any impact on the service! Thank you to all for your assistance. Now to get my head down and learn CI so I can take care of this beast of a website myself.

Theme © iAndrew 2016 - Forum software by © MyBB