PHP Class yii\caching\XCache
To use this application component, the
XCache PHP extension must be loaded.
Also note that the [[flush()]] functionality will work correctly only if "xcache.admin.enable_auth"
is set to "Off" in php.ini.
See
Cache for common cache operations that XCache supports.
For more details and usage information on Cache, see the
guide article on caching.
显示文件
Open project: yiisoft/yii2
Public Methods
Method |
Description |
|
exists ( mixed $key ) : boolean |
Checks whether a specified key exists in the cache. |
|
Protected Methods
Method Details
addValue()
protected method
This is the implementation of the method declared in the parent class.
protected addValue ( string $key, mixed $value, integer $duration ) : boolean |
$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 means never expire. |
return |
boolean |
true if the value is successfully stored into cache, false otherwise |
deleteValue()
protected method
Deletes a value with the specified key from cache
This is the implementation of the method declared in the parent class.
This can be faster than getting the value from the cache if the data is big.
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 exists ( mixed $key ) : boolean |
$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 |
boolean |
true if a value exists in cache, false if the value is not in the cache or expired. |
flushValues()
protected method
This is the implementation of the method declared in the parent class.
getValue()
protected method
This is the implementation of the method declared in the parent class.
protected getValue ( string $key ) : mixed | false |
$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. |
setValue()
protected method
This is the implementation of the method declared in the parent class.
protected setValue ( string $key, mixed $value, integer $duration ) : boolean |
$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 means never expire. |
return |
boolean |
true if the value is successfully stored into cache, false otherwise |