caching\Cache addValues()

addValues() protected method Adds multiple key-value pairs to cache. The default implementation calls addValue() multiple times add values one by one. If the underlying cache storage supports multi-add, this method should be overridden to exploit that feature. protected array addValues ( $data, $duration )$data array Array where key corresponds to cache key while value is the value stored. $duration integer The number of seconds in which the cached values will expire. 0 means never exp

caching\Cache addValue()

addValue() protected abstract method Stores a value identified by a key into cache if the cache does not contain this key. This method should be implemented by child classes to store the data in specific cache storage. protected abstract boolean addValue ( $key, $value, $duration )$key string The key identifying the value to be cached $value mixed The value to be cached. Most often it's a string. If you have disabled $serializer, it could be something else. $duration integer The numb

caching\Cache delete()

delete() public method Deletes a value with the specified key from cache public boolean delete ( $key )$key mixed A key identifying the value to be deleted from cache. This can be a simple string or a complex data structure consisting of factors representing the key. return boolean If no error happens during deletion

caching\Cache buildKey()

buildKey() public method Builds a normalized cache key from a given key. If the given key is a string containing alphanumeric characters only and no more than 32 characters, then the key will be returned back prefixed with $keyPrefix. Otherwise, a normalized key is generated by serializing the given key, applying MD5 hashing, and prefixing with $keyPrefix. public string buildKey ( $key )$key mixed The key to be normalized return string The generated cache key

caching\Cache $serializer

$serializer public property The functions used to serialize and unserialize cached data. Defaults to null, meaning using the default PHP serialize() and unserialize() functions. If you want to use some more efficient serializer (e.g. igbinary), you may configure this property with a two-element array. The first element specifies the serialization function, and the second the deserialization function. If this property is set false, data will be directly sent to and retrieved from the underly

caching\Cache $keyPrefix

$keyPrefix public property A string prefixed to every cache key so that it is unique globally in the whole cache storage. It is recommended that you set a unique cache key prefix for each application if the same cache storage is being used by different applications. To ensure interoperability, only alphanumeric characters should be used. public string $keyPrefix = null

caching\Cache add()

add() public method Stores a value identified by a key into cache if the cache does not contain this key. Nothing will be done if the cache already contains the key. public boolean add ( $key, $value, $duration = 0, $dependency = null )$key mixed A key identifying the value to be cached. This can be a simple string or a complex data structure consisting of factors representing the key. $value mixed The value to be cached $duration integer The number of seconds in which the cached val

caching\ArrayCache getValue()

getValue() protected method Retrieves a value from cache with a specified key. This method should be implemented by child classes to retrieve the data from specific cache storage. protected mixed|false getValue ( $key )$key string A unique key identifying the cached value return mixed|false The value stored in cache, false if the value is not in the cache or expired. Most often value is a string. If you have disabled $serializer, it could be something else.

caching\ArrayCache exists()

exists() public method Checks whether a specified key exists in the cache. This can be faster than getting the value from the cache if the data is big. In case a cache does not support this feature natively, this method will try to simulate it but has no performance improvement over getting it. Note that this method does not check whether the dependency associated with the cached data, if there is any, has changed. So a call to get() may return false while exists returns true. public bool

caching\ArrayCache setValue()

setValue() protected method Stores a value identified by a key in cache. This method should be implemented by child classes to store the data in specific cache storage. protected boolean setValue ( $key, $value, $duration )$key string The key identifying the value to be cached $value mixed The value to be cached. Most often it's a string. If you have disabled $serializer, it could be something else. $duration integer The number of seconds in which the cached value will expire. 0 mean