CodeIgniter Forums
Making Personal cache folder for a separate controller on CI4 (Code igniter 4) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10)
+--- Thread: Making Personal cache folder for a separate controller on CI4 (Code igniter 4) (/showthread.php?tid=80535)



Making Personal cache folder for a separate controller on CI4 (Code igniter 4) - saraholsen - 11-12-2021

I am new to Codeigniter and getting along it very quickly. And now I want to go on advance mode. So I decide to make a separate cache file for the controller. 
So to make the cache file I checked the file  app/config/Cache.php where can set our cache folder if I am right. Complexity arises because of the Linux system.
I have a large number of files. Now I want to set a separate path for a specific folder. How can I make it happen? I am a data engineer but not quite good at this web stuff.
Thanks in advance for any help.


RE: Making Personal cache folder for a separate controller on CI4 (Code igniter 4) - captain-sensible - 11-13-2021

if i understand the documentation correctly, you can put something like :
Code:
$this->cachePage(DAY);
in the method of your controller class

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


RE: Making Personal cache folder for a separate controller on CI4 (Code igniter 4) - jreklund - 11-13-2021

Hi,

This is not possible out of the box. Here are some options:
1. Initialize a custom Cache using FileHandler for every controller see \tests\system\Cache\Handlers\FileHandlerTest:setUp
2. Initialize a custom Cache using cache service for every controller see \system\Config\Services\Services:cache
3. Extend FileHandler and add support for changing the output path