0

I have a music site developed on CodeIgniter with youtube API without database. Recently I have noticed that too many files are getting generated in system/cache folder.
How can I stop generating this cache files? Note that I am not using any cache method.

6
  • have you checked this one? stackoverflow.com/questions/19775382/codeigniter-disable-cache Commented Feb 25, 2019 at 6:04
  • It's strange but by default I have not found anything to disable cache in codeigniter globally Commented Feb 25, 2019 at 6:04
  • too much file generating, i am running out of my memory. @RahulMeshram Commented Feb 25, 2019 at 6:18
  • I haven't try yet @MiftahMizwar Commented Feb 25, 2019 at 6:18
  • @DropShadow search $this->output->cache in your project Commented Feb 25, 2019 at 6:43

2 Answers 2

1

system/cache is NOT default codeigniter cache directory at first. I would not store cache in there, as its framework main folder. Default is application/cache.

By default, CI does NOT cache anything. So your application is build with caching. You told you don't use database, so it's not DB cache I assume.

Check in your app for somethign like "$this->load->driver('cache'". Caching can be loaded WITHOUT additional parameters like $this->load->driver('cache'); OR with parameters like $this->load->driver('cache',array('adapther'=>'xxx'));

https://www.codeigniter.com/userguide3/libraries/caching.html

Now, in your app search for $this->cache->save OR $this->cache->file->save if you found this, it means you are using CI caching.

Problem is, you cannot just remove cache loading, as app initiates cache object, and your app will fail, unless you rewrite all places where caching is used.

Now, you have few choices:

1.just clean cache dir with some script periodically via cron.

  1. you can change cache folder permissions to NON writable, which will generate warnings in your logs, so logging should be disabled. This is not the right way IMHO, as can cause fatal errors/blank pages but just one of possible solutions. If file caching is used, this should not cause issues, while in other cases it could.

  2. you can extend caching library, and simply create empty cache SAVE function. In this case your files will not be saved.

  3. you can cache to memcached, if you have it on your server. Well, if your caching is written like $this->cache->file->{operation}, then you will need update all those to $this->cache->memcached->{operation}. If caching is written like $this->cache->{operation}, you can just adjust configuration something like

$this->load->driver('cache',array('adapther'=>'memcached'));

and set memcached server info in config file. (config/memcached.php)

You told you are not using any caching method. So you should not find any of code I put above.

The last thing I can think about is

$this->output->cache(xxx); where xxx is cache time in minutes. it forces entire generated page to be cached; if you find such lines, you can try comment them out and see what happens

https://www.codeigniter.com/user_guide/general/caching.html

there is a good note: If you change configuration options that might affect your output, you have to manually delete your cache files.

If absolutely none from the examples above is not found, you might use some custom make caching.

Good luck!

Sign up to request clarification or add additional context in comments.

Comments

0

Put this in your common controller

$this->output->delete_cache();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.