5
use CodeIgniter\Cache\CacheInterface;
6
use CodeIgniter\Cache\Handlers\DummyHandler;
7
use CodeIgniter\Cache\Handlers\FileHandler;
8
use CodeIgniter\Cache\Handlers\MemcachedHandler;
9
use CodeIgniter\Cache\Handlers\PredisHandler;
10
use CodeIgniter\Cache\Handlers\RedisHandler;
11
use CodeIgniter\Cache\Handlers\WincacheHandler;
12
use CodeIgniter\Config\BaseConfig;
14
class Cache extends BaseConfig
17
* --------------------------------------------------------------------------
19
* --------------------------------------------------------------------------
21
* The name of the preferred handler that should be used. If for some reason
22
* it is not available, the $backupHandler will be used in its place.
24
public string $handler = 'file';
27
* --------------------------------------------------------------------------
29
* --------------------------------------------------------------------------
31
* The name of the handler that will be used in case the first one is
32
* unreachable. Often, 'file' is used here since the filesystem is
33
* always available, though that's not always practical for the app.
35
public string $backupHandler = 'dummy';
38
* --------------------------------------------------------------------------
39
* Cache Directory Path
40
* --------------------------------------------------------------------------
42
* The path to where cache files should be stored, if using a file-based
45
* @deprecated Use the driver-specific variant under $file
47
public string $storePath = WRITEPATH . 'cache/';
50
* --------------------------------------------------------------------------
52
* --------------------------------------------------------------------------
54
* This string is added to all cache item names to help avoid collisions
55
* if you run multiple applications with the same cache engine.
57
public string $prefix = '';
60
* --------------------------------------------------------------------------
62
* --------------------------------------------------------------------------
64
* The default number of seconds to save items when none is specified.
66
* WARNING: This is not used by framework handlers where 60 seconds is
67
* hard-coded, but may be useful to projects and modules. This will replace
68
* the hard-coded value in a future release.
73
* --------------------------------------------------------------------------
75
* --------------------------------------------------------------------------
77
* A string of reserved characters that will not be allowed in keys or tags.
78
* Strings that violate this restriction will cause handlers to throw.
81
* NOTE: The default set is required for PSR-6 compliance.
83
public string $reservedCharacters = '{}()/\@:';
86
* --------------------------------------------------------------------------
88
* --------------------------------------------------------------------------
89
* Your file storage preferences can be specified below, if you are using
92
* @var array<string, int|string|null>
94
public array $file = [
95
'storePath' => WRITEPATH . 'cache/',
100
* -------------------------------------------------------------------------
102
* -------------------------------------------------------------------------
103
* Your Memcached servers can be specified below, if you are using
104
* the Memcached drivers.
106
* @see https://codeigniter.com/user_guide/libraries/caching.html#memcached
108
* @var array<string, bool|int|string>
110
public array $memcached = [
111
'host' => '127.0.0.1',
118
* -------------------------------------------------------------------------
120
* -------------------------------------------------------------------------
121
* Your Redis server can be specified below, if you are using
122
* the Redis or Predis drivers.
124
* @var array<string, int|string|null>
126
public array $redis = [
127
'host' => '127.0.0.1',
135
* --------------------------------------------------------------------------
136
* Available Cache Handlers
137
* --------------------------------------------------------------------------
139
* This is an array of cache engine alias' and class names. Only engines
140
* that are listed here are allowed to be used.
142
* @var array<string, class-string<CacheInterface>>
144
public array $validHandlers = [
145
'dummy' => DummyHandler::class,
146
'file' => FileHandler::class,
147
'memcached' => MemcachedHandler::class,
148
'predis' => PredisHandler::class,
149
'redis' => RedisHandler::class,
150
'wincache' => WincacheHandler::class,
154
* --------------------------------------------------------------------------
155
* Web Page Caching: Cache Include Query String
156
* --------------------------------------------------------------------------
158
* Whether to take the URL query string into consideration when generating
159
* output cache files. Valid options are:
162
* true = Enabled, take all query parameters into account.
163
* Please be aware that this may result in numerous cache
164
* files generated for the same page over and over again.
165
* ['q'] = Enabled, but only take into account the specified list
166
* of query parameters.
168
* @var bool|list<string>
170
public $cacheQueryString = false;