The cache config is located at app/config/cache.php
. These options control the application cache.
The application cache driver. Setting this value to array
will disable the cache across requests. Additional driver-specific options may be required with certain values.
apcu
, array
, file
, memcached
, redis
, php-file
file
CACHE_DRIVER
The app cache lifetime (in seconds). Setting this value to 0
will cache indefinitely.
Any positive integer
0
(indefinitely)
CACHE_LIFETIME
The Memcached server hostname or IP address.
Any string
localhost
MEMCACHED_HOST
The Memcached server port.
Any valid port as an integer (0
to 65353
)
11211
MEMCACHED_PORT
The Memcached configuration anonymous function (closure). This option is used when the cache_driver
configuration option is set to memcached
. The closure receives a Memcached
object as it's only parameter. You can use this object to configure the Memcached connection. At a minimum you must connect to one or more Memcached servers via the addServer()
or addServers()
methods.
Reference the PHP Memcached documentation for Memcached configuration options.
An anonymous function that receives a Memcached
object
function (Memcached $memcached): void {// Configure the $memcached object}
DI\value(function (Memcached $memcached, Config $config): void {$memcached->addServer($config->get('memcached_host'),$config->get('memcached_port'));})
This closure adds a single connection to a server at the host defined by memcached_host
on the port defined by memcached_port
.
Uses the MEMCACHED_HOST
and MEMCACHED_PORT
variables by default
The Redis server hostname or IP address.
Any string
localhost
REDIS_HOST
The Redis server port.
Any valid port as an integer (0
to 65353
)
6379
REDIS_PORT
The Redis configuration anonymous function (closure). This option is used when the cache_driver
configuration option is set to redis
. The closure receives a Redis
object as it's only parameter. You can use this object to configure the Redis connection. At a minimum you must connect to one or more Redis servers via the connect()
or pconnect()
methods.
Reference the phpredis documentation for Redis configuration options.
An anonymous function that receives a Redis
object
function (Redis $redis): void {// Configure the $redis object}
DI\value(function (Redis $redis, Config $config): void {$redis->pconnect($config->get('redis_host'),$config->get('redis_port'));})
This closure adds a single connection to a server at the host defined by redis_host
on the port defined by redis_port
.
Uses the REDIS_HOST
and REDIS_PORT
variables by default
HTTP expires values. An array of mimetypes mapped to their cache duration values.
An array of mime types mapped to their cache duration as a relative datetime string.
['application/zip' => '+1 hour','text/json' => '+1 hour',]
Path to the view cache directory. Set to false
to disable view caching entirely.
A directory path as a string or false
to disable the view cache entirely
app/cache/views
VIEW_CACHE