Documentation

Cache extends BaseConfig
in package

Table of Contents

Properties

$backupHandler  : string
-------------------------------------------------------------------------- Backup Handler --------------------------------------------------------------------------
$cacheQueryString  : bool|array<int, string>
-------------------------------------------------------------------------- Web Page Caching: Cache Include Query String --------------------------------------------------------------------------
$file  : array{storePath?: string, mode?: int}
-------------------------------------------------------------------------- File settings --------------------------------------------------------------------------
$handler  : string
-------------------------------------------------------------------------- Primary Handler --------------------------------------------------------------------------
$memcached  : array{host?: string, port?: int, weight?: int, raw?: bool}
------------------------------------------------------------------------- Memcached settings -------------------------------------------------------------------------
$prefix  : string
-------------------------------------------------------------------------- Key Prefix --------------------------------------------------------------------------
$redis  : array{host?: string, password?: string|null, port?: int, timeout?: int, database?: int}
------------------------------------------------------------------------- Redis settings -------------------------------------------------------------------------
$reservedCharacters  : string
-------------------------------------------------------------------------- Reserved Characters --------------------------------------------------------------------------
$ttl  : int
-------------------------------------------------------------------------- Default TTL --------------------------------------------------------------------------
$validHandlers  : array<string, CacheInterface>>
-------------------------------------------------------------------------- Available Cache Handlers --------------------------------------------------------------------------

Properties

$backupHandler

-------------------------------------------------------------------------- Backup Handler --------------------------------------------------------------------------

public string $backupHandler = 'dummy'

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.

$cacheQueryString

-------------------------------------------------------------------------- Web Page Caching: Cache Include Query String --------------------------------------------------------------------------

public bool|array<int, string> $cacheQueryString = false

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.

$file

-------------------------------------------------------------------------- File settings --------------------------------------------------------------------------

public array{storePath?: string, mode?: int} $file = ['storePath' => WRITEPATH . 'cache/', 'mode' => 0640]

Your file storage preferences can be specified below, if you are using the File driver.

$handler

-------------------------------------------------------------------------- Primary Handler --------------------------------------------------------------------------

public string $handler = 'file'

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.

$memcached

------------------------------------------------------------------------- Memcached settings -------------------------------------------------------------------------

public array{host?: string, port?: int, weight?: int, raw?: bool} $memcached = ['host' => '127.0.0.1', 'port' => 11211, 'weight' => 1, 'raw' => false]

Your Memcached servers can be specified below, if you are using the Memcached drivers.

Tags
see
https://codeigniter.com/user_guide/libraries/caching.html#memcached

$prefix

-------------------------------------------------------------------------- Key Prefix --------------------------------------------------------------------------

public string $prefix = ''

This string is added to all cache item names to help avoid collisions if you run multiple applications with the same cache engine.

$redis

------------------------------------------------------------------------- Redis settings -------------------------------------------------------------------------

public array{host?: string, password?: string|null, port?: int, timeout?: int, database?: int} $redis = ['host' => '127.0.0.1', 'password' => null, 'port' => 6379, 'timeout' => 0, 'database' => 0]

Your Redis server can be specified below, if you are using the Redis or Predis drivers.

$reservedCharacters

-------------------------------------------------------------------------- Reserved Characters --------------------------------------------------------------------------

public string $reservedCharacters = '{}()/\@:'

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: }()/@:

NOTE: The default set is required for PSR-6 compliance.

$ttl

-------------------------------------------------------------------------- Default TTL --------------------------------------------------------------------------

public int $ttl = 60

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.

$validHandlers

-------------------------------------------------------------------------- Available Cache Handlers --------------------------------------------------------------------------

public array<string, CacheInterface>> $validHandlers = ['dummy' => \CodeIgniter\Cache\Handlers\DummyHandler::class, 'file' => \CodeIgniter\Cache\Handlers\FileHandler::class, 'memcached' => \CodeIgniter\Cache\Handlers\MemcachedHandler::class, 'predis' => \CodeIgniter\Cache\Handlers\PredisHandler::class, 'redis' => \CodeIgniter\Cache\Handlers\RedisHandler::class, 'wincache' => \CodeIgniter\Cache\Handlers\WincacheHandler::class]

This is an array of cache engine alias' and class names. Only engines that are listed here are allowed to be used.


        
On this page

Search results