caching\Cache setValue()

setValue() protected abstract 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 abstract 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 w

caching\Cache offsetUnset()

offsetUnset() public method Deletes the value with the specified key from cache This method is required by the interface ArrayAccess. public void offsetUnset ( $key )$key string The key of the value to be deleted

caching\Cache set()

set() public method Stores a value identified by a key into cache. If the cache already contains such a key, the existing value and expiration time will be replaced with the new ones, respectively. public boolean set ( $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

caching\Cache setValues()

setValues() protected method Stores multiple key-value pairs in cache. The default implementation calls setValue() multiple times store values one by one. If the underlying cache storage supports multi-set, this method should be overridden to exploit that feature. protected array setValues ( $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

caching\Cache offsetSet()

offsetSet() public method Stores the value identified by a key into cache. If the cache already contains such a key, the existing value will be replaced with the new ones. To add expiration and dependencies, use the set() method. This method is required by the interface ArrayAccess. public void offsetSet ( $key, $value )$key string The key identifying the value to be cached $value mixed The value to be cached

caching\Cache offsetGet()

offsetGet() public method Retrieves the value from cache with a specified key. This method is required by the interface ArrayAccess. public mixed offsetGet ( $key )$key string A key identifying the cached value return mixed The value stored in cache, false if the value is not in the cache or expired.

caching\Cache multiSet()

multiSet() public method (available since version 2.0.7) Stores multiple items in cache. Each item contains a value identified by a key. If the cache already contains such a key, the existing value and expiration time will be replaced with the new ones, respectively. public boolean multiSet ( $items, $duration = 0, $dependency = null )$items array The items to be cached, as key-value pairs. $duration integer Default number of seconds in which the cached values will expire. 0 means neve

caching\Cache offsetExists()

offsetExists() public method Returns whether there is a cache entry with a specified key. This method is required by the interface ArrayAccess. public boolean offsetExists ( $key )$key string A key identifying the cached value

caching\Cache multiGet()

multiGet() public method (available since version 2.0.7) Retrieves multiple values from cache with the specified keys. Some caches (such as memcache, apc) allow retrieving multiple cached values at the same time, which may improve the performance. In case a cache does not support this feature natively, this method will try to simulate it. public array multiGet ( $keys )$keys string[] List of string keys identifying the cached values return array List of cached values corresponding to

caching\Cache multiAdd()

multiAdd() public method (available since version 2.0.7) Stores multiple items in cache. Each item contains a value identified by a key. If the cache already contains such a key, the existing value and expiration time will be preserved. public boolean multiAdd ( $items, $duration = 0, $dependency = null )$items array The items to be cached, as key-value pairs. $duration integer Default number of seconds in which the cached values will expire. 0 means never expire. $dependency yii\cach