Welcome Guest, Not a member yet? Register   Sign In
Making Personal cache folder for a separate controller on CI4 (Code igniter 4)
#1

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.
Reply
#2

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
Arch Book  CodeIgniter4 on Apache(pages 92-114) 
Reply
#3

(This post was last modified: 11-13-2021, 06:27 AM by jreklund.)

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
Reply




Theme © iAndrew 2016 - Forum software by © MyBB