2022-03-14 19:13:10 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Config;
|
|
|
|
|
2024-04-07 22:17:30 +02:00
|
|
|
use CodeIgniter\Cache\CacheInterface;
|
2022-03-14 19:13:10 +01:00
|
|
|
use CodeIgniter\Cache\Handlers\DummyHandler;
|
|
|
|
use CodeIgniter\Cache\Handlers\FileHandler;
|
|
|
|
use CodeIgniter\Cache\Handlers\MemcachedHandler;
|
|
|
|
use CodeIgniter\Cache\Handlers\PredisHandler;
|
|
|
|
use CodeIgniter\Cache\Handlers\RedisHandler;
|
|
|
|
use CodeIgniter\Cache\Handlers\WincacheHandler;
|
|
|
|
use CodeIgniter\Config\BaseConfig;
|
|
|
|
|
|
|
|
class Cache extends BaseConfig
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
* Primary Handler
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* The name of the preferred handler that should be used. If for some reason
|
|
|
|
* it is not available, the $backupHandler will be used in its place.
|
|
|
|
*/
|
2024-04-07 22:17:30 +02:00
|
|
|
public string $handler = 'file';
|
2022-03-14 19:13:10 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
* Backup Handler
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* The name of the handler that will be used in case the first one is
|
|
|
|
* unreachable. Often, 'file' is used here since the filesystem is
|
|
|
|
* always available, though that's not always practical for the app.
|
|
|
|
*/
|
2024-04-07 22:17:30 +02:00
|
|
|
public string $backupHandler = 'dummy';
|
2022-03-14 19:13:10 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
* Cache Directory Path
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* The path to where cache files should be stored, if using a file-based
|
|
|
|
* system.
|
|
|
|
*
|
|
|
|
* @deprecated Use the driver-specific variant under $file
|
|
|
|
*/
|
2024-04-07 22:17:30 +02:00
|
|
|
public string $storePath = WRITEPATH . 'cache/';
|
2022-03-14 19:13:10 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
* Key Prefix
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* This string is added to all cache item names to help avoid collisions
|
|
|
|
* if you run multiple applications with the same cache engine.
|
|
|
|
*/
|
2024-04-07 22:17:30 +02:00
|
|
|
public string $prefix = '';
|
2022-03-14 19:13:10 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
* Default TTL
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* The default number of seconds to save items when none is specified.
|
|
|
|
*
|
|
|
|
* WARNING: This is not used by framework handlers where 60 seconds is
|
|
|
|
* hard-coded, but may be useful to projects and modules. This will replace
|
|
|
|
* the hard-coded value in a future release.
|
|
|
|
*/
|
2024-04-07 22:17:30 +02:00
|
|
|
public int $ttl = 60;
|
2022-03-14 19:13:10 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
* Reserved Characters
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* A string of reserved characters that will not be allowed in keys or tags.
|
|
|
|
* Strings that violate this restriction will cause handlers to throw.
|
|
|
|
* Default: {}()/\@:
|
|
|
|
*
|
2024-04-07 22:17:30 +02:00
|
|
|
* NOTE: The default set is required for PSR-6 compliance.
|
2022-03-14 19:13:10 +01:00
|
|
|
*/
|
2024-04-07 22:17:30 +02:00
|
|
|
public string $reservedCharacters = '{}()/\@:';
|
2022-03-14 19:13:10 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
* File settings
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
* Your file storage preferences can be specified below, if you are using
|
|
|
|
* the File driver.
|
|
|
|
*
|
|
|
|
* @var array<string, int|string|null>
|
|
|
|
*/
|
2024-04-07 22:17:30 +02:00
|
|
|
public array $file = [
|
2022-03-14 19:13:10 +01:00
|
|
|
'storePath' => WRITEPATH . 'cache/',
|
|
|
|
'mode' => 0640,
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
* Memcached settings
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
* Your Memcached servers can be specified below, if you are using
|
|
|
|
* the Memcached drivers.
|
|
|
|
*
|
|
|
|
* @see https://codeigniter.com/user_guide/libraries/caching.html#memcached
|
|
|
|
*
|
2024-04-07 22:17:30 +02:00
|
|
|
* @var array<string, bool|int|string>
|
2022-03-14 19:13:10 +01:00
|
|
|
*/
|
2024-04-07 22:17:30 +02:00
|
|
|
public array $memcached = [
|
2022-03-14 19:13:10 +01:00
|
|
|
'host' => '127.0.0.1',
|
|
|
|
'port' => 11211,
|
|
|
|
'weight' => 1,
|
|
|
|
'raw' => false,
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
* Redis settings
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
* Your Redis server can be specified below, if you are using
|
|
|
|
* the Redis or Predis drivers.
|
|
|
|
*
|
|
|
|
* @var array<string, int|string|null>
|
|
|
|
*/
|
2024-04-07 22:17:30 +02:00
|
|
|
public array $redis = [
|
2022-03-14 19:13:10 +01:00
|
|
|
'host' => '127.0.0.1',
|
|
|
|
'password' => null,
|
|
|
|
'port' => 6379,
|
|
|
|
'timeout' => 0,
|
|
|
|
'database' => 0,
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
* Available Cache Handlers
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* This is an array of cache engine alias' and class names. Only engines
|
|
|
|
* that are listed here are allowed to be used.
|
|
|
|
*
|
2024-04-07 22:17:30 +02:00
|
|
|
* @var array<string, class-string<CacheInterface>>
|
2022-03-14 19:13:10 +01:00
|
|
|
*/
|
2024-04-07 22:17:30 +02:00
|
|
|
public array $validHandlers = [
|
2022-03-14 19:13:10 +01:00
|
|
|
'dummy' => DummyHandler::class,
|
|
|
|
'file' => FileHandler::class,
|
|
|
|
'memcached' => MemcachedHandler::class,
|
|
|
|
'predis' => PredisHandler::class,
|
|
|
|
'redis' => RedisHandler::class,
|
|
|
|
'wincache' => WincacheHandler::class,
|
|
|
|
];
|
2024-04-07 22:17:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
* Web Page Caching: Cache Include Query String
|
|
|
|
* --------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* Whether to take the URL query string into consideration when generating
|
|
|
|
* output cache files. Valid options are:
|
|
|
|
*
|
|
|
|
* false = Disabled
|
|
|
|
* true = Enabled, take all query parameters into account.
|
|
|
|
* Please be aware that this may result in numerous cache
|
|
|
|
* files generated for the same page over and over again.
|
|
|
|
* ['q'] = Enabled, but only take into account the specified list
|
|
|
|
* of query parameters.
|
|
|
|
*
|
|
|
|
* @var bool|list<string>
|
|
|
|
*/
|
|
|
|
public $cacheQueryString = false;
|
2022-03-14 19:13:10 +01:00
|
|
|
}
|