Cache Config Reference

The cache config is located at app/config/cache.php. These options control the application cache.

cache_driver

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

cache_lifetime

The app cache lifetime (in seconds). Setting this value to 0 will cache indefinitely.

Any positive integer

cache_lottery

Some cache drivers require manually pruning the cache periodically to remove expired items. This is the percentage chance (out of 100) of a request "winning" the lottery causing the cache to be pruned.

Any integer betweeen 1 and 100

memcached_host

The Memcached server hostname or IP address.

Any string

memcached_port

The Memcached server port.

Any valid port as an integer (0 to 65353)

memcached_config

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
}

redis_host

The Redis server hostname or IP address.

Any string

redis_port

The Redis server port.

Any valid port as an integer (0 to 65353)

redis_config

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
}

http_cache

HTTP cache values for controlling browser page cache durations. An array of mimetypes mapped to their cache duration in seconds..

An array of mime types mapped to their cache duration as a seconds (integers).

view_cache

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

Last updated