Cache
Provides a standardized interface to implement caching and shared memory mechanisms into an App by connecting to multiple external cache providers.
See the Cache guide to learn how to work with the Cache module.
Configuration
providersA hash array of the available cache providers, where the key is the name of the cache provider, and the value is a hash array with the following possible keys:providerClassNameThe name of the cache provider class, from the available ones:CacheProviderApcCacheProviderApcuCacheProviderMemcachedCacheProviderRedis
configA hash array of configuration options for the cache provider, where each different cache provider has different available config keys:For
CacheProviderApc: No configuration needed.For
CacheProviderApcu: No configuration needed.For
CacheProviderMemcached:isPersistentConnectionisCompressionserversAn array of the servers to add to the server Memcached pool, as documented in https://www.php.net/manual/en/memcached.addservers.php
For
CacheProviderRedis:schemeThe connection scheme. Default:tcphostThe host name or IP of the Redis server. Default:localhostportThe server port. Default:6379databaseThe Redis database number to use. Default:0prefixThe prefix to use for all cache keys. Used to avoid key collisions with other apps that might be running in the server. Defaults to none.isPersistentConnectionWhether to keep the connection to Redis active between requests. Default:true
Constants
CACHE_TTL_1_MINUTECACHE_TTL_5_MINUTESCACHE_TTL_10_MINUTESCACHE_TTL_30_MINUTESCACHE_TTL_1_HOURCACHE_TTL_2_HOURSCACHE_TTL_6_HOURSCACHE_TTL_12_HOURSCACHE_TTL_1_DAYCACHE_TTL_2_DAYSCACHE_TTL_3_DAYSCACHE_TTL_5_DAYSCACHE_TTL_1_WEEKCACHE_TTL_2_WEEKSCACHE_TTL_1_MONTH
CACHE_TTL_MINIMAL10 secondsCACHE_TTL_CRITICAL1 minuteCACHE_TTL_SHORT5 minutesCACHE_TTL_NORMAL1 hourCACHE_TTL_UNCRITICAL1 dayCACHE_TTL_LONG1 weekCACHE_TTL_LONGEST1 month
Last updated
Was this helpful?