Cache
extends BaseConfig
in package
Class BaseConfig
Not intended to be used on its own, this class will attempt to automatically populate the child class' properties with values from the environment.
These can be set within the .env file.
Table of Contents
- $backupHandler : string
- -------------------------------------------------------------------------- Backup Handler --------------------------------------------------------------------------
- $cacheQueryString : bool|array<string|int, string>
- -------------------------------------------------------------------------- Cache Include Query String --------------------------------------------------------------------------
- $file : array<string, string|int|null>
- -------------------------------------------------------------------------- File settings -------------------------------------------------------------------------- Your file storage preferences can be specified below, if you are using the File driver.
- $handler : string
- -------------------------------------------------------------------------- Primary Handler --------------------------------------------------------------------------
- $memcached : array<string, string|int|bool>
- ------------------------------------------------------------------------- Memcached settings ------------------------------------------------------------------------- Your Memcached servers can be specified below, if you are using the Memcached drivers.
- $prefix : string
- -------------------------------------------------------------------------- Key Prefix --------------------------------------------------------------------------
- $redis : array<string, string|int|null>
- ------------------------------------------------------------------------- Redis settings ------------------------------------------------------------------------- Your Redis server can be specified below, if you are using the Redis or Predis drivers.
- $registrars : array<string|int, mixed>
- An optional array of classes that will act as Registrars for rapidly setting config class properties.
- $storePath : string
- -------------------------------------------------------------------------- Cache Directory Path --------------------------------------------------------------------------
- $ttl : int
- -------------------------------------------------------------------------- Default TTL --------------------------------------------------------------------------
- $validHandlers : array<string, string>
- -------------------------------------------------------------------------- Available Cache Handlers --------------------------------------------------------------------------
- $didDiscovery : bool
- Has module discovery happened yet?
- $moduleConfig : Modules
- The modules configuration.
- __construct() : mixed
- Will attempt to get environment variables with names that match the properties of the child class.
- getEnvValue() : mixed
- Retrieve an environment-specific configuration setting
- initEnvValue() : mixed
- Initialization an environment-specific configuration setting
- registerProperties() : mixed
- Provides external libraries a simple way to register one or more options into a config file.
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
-------------------------------------------------------------------------- Cache Include Query String --------------------------------------------------------------------------
public
bool|array<string|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. array('q') = Enabled, but only take into account the specified list of query parameters.
$file
-------------------------------------------------------------------------- File settings -------------------------------------------------------------------------- Your file storage preferences can be specified below, if you are using the File driver.
public
array<string, string|int|null>
$file
= ['storePath' => WRITEPATH . 'cache/', 'mode' => 0640]
$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 ------------------------------------------------------------------------- Your Memcached servers can be specified below, if you are using the Memcached drivers.
public
array<string, string|int|bool>
$memcached
= ['host' => '127.0.0.1', 'port' => 11211, 'weight' => 1, 'raw' => false]
Tags
$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 ------------------------------------------------------------------------- Your Redis server can be specified below, if you are using the Redis or Predis drivers.
public
array<string, string|int|null>
$redis
= ['host' => '127.0.0.1', 'password' => null, 'port' => 6379, 'timeout' => 0, 'database' => 0]
$registrars
An optional array of classes that will act as Registrars for rapidly setting config class properties.
public
static array<string|int, mixed>
$registrars
= []
$storePath
-------------------------------------------------------------------------- Cache Directory Path --------------------------------------------------------------------------
public
string
$storePath
= WRITEPATH . 'cache/'
The path to where cache files should be stored, if using a file-based system.
Tags
$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, string>
$validHandlers
= ['dummy' => CodeIgniterCacheHandlersDummyHandler::class, 'file' => CodeIgniterCacheHandlersFileHandler::class, 'memcached' => CodeIgniterCacheHandlersMemcachedHandler::class, 'predis' => CodeIgniterCacheHandlersPredisHandler::class, 'redis' => CodeIgniterCacheHandlersRedisHandler::class, 'wincache' => CodeIgniterCacheHandlersWincacheHandler::class]
This is an array of cache engine alias' and class names. Only engines that are listed here are allowed to be used.
$didDiscovery
Has module discovery happened yet?
protected
static bool
$didDiscovery
= false
$moduleConfig
The modules configuration.
protected
static Modules
$moduleConfig
Methods
__construct()
Will attempt to get environment variables with names that match the properties of the child class.
public
__construct() : mixed
The "shortPrefix" is the lowercase-only config class name.
Return values
mixed —getEnvValue()
Retrieve an environment-specific configuration setting
protected
getEnvValue(string $property, string $prefix, string $shortPrefix) : mixed
Parameters
- $property : string
- $prefix : string
- $shortPrefix : string
Return values
mixed —initEnvValue()
Initialization an environment-specific configuration setting
protected
initEnvValue(mixed &$property, string $name, string $prefix, string $shortPrefix) : mixed
Parameters
- $property : mixed
- $name : string
- $prefix : string
- $shortPrefix : string
Return values
mixed —registerProperties()
Provides external libraries a simple way to register one or more options into a config file.
protected
registerProperties() : mixed