caching\Cache mset()

mset() public method 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 mset ( $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\caching\Depen

caching\Cache getValue()

getValue() protected abstract 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 abstract 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\Cache getValues()

getValues() protected method Retrieves multiple values from cache with the specified keys. The default implementation calls getValue() multiple times to retrieve the cached values one by one. If the underlying cache storage supports multiget, this method should be overridden to exploit that feature. protected array getValues ( $keys )$keys array A list of keys identifying the cached values return array A list of cached values indexed by the keys

caching\Cache madd()

madd() public method 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 madd ( $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\caching\Dependency Dependency of the cached

caching\Cache mget()

mget() public method 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 mget ( $keys )$keys string[] List of string keys identifying the cached values return array List of cached values corresponding to the specified keys. The array is returne

caching\Cache deleteValue()

deleteValue() protected abstract method Deletes a value with the specified key from cache This method should be implemented by child classes to delete the data from actual cache storage. protected abstract boolean deleteValue ( $key )$key string The key of the value to be deleted return boolean If no error happens during deletion

caching\Cache flush()

flush() public method Deletes all values from cache. Be careful of performing this operation if the cache is shared among multiple applications. public boolean flush ( )return boolean Whether the flush operation was successful.

caching\Cache 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\Cache flushValues()

flushValues() protected abstract method Deletes all values from cache. Child classes may implement this method to realize the flush operation. protected abstract boolean flushValues ( )return boolean Whether the flush operation was successful.

caching\Cache get()

get() public method Retrieves a value from cache with a specified key. public mixed get ( $key )$key mixed A key identifying the cached value. This can be a simple string or a complex data structure consisting of factors representing the key. return mixed The value stored in cache, false if the value is not in the cache, expired, or the dependency associated with the cached data has changed.