PHP Класс Prado\Caching\TXCache
TXCache implements a cache application module based on {@link http://xcache.lighttpd.net/ xcache}.
By definition, cache does not ensure the existence of a value
even if it never expires. Cache is not meant to be an persistent storage.
To use this module, the xcache PHP extension must be loaded and configured in the php.ini.
Some usage examples of TXCache are as follows,
$cache=new TXCache; // TXCache may also be loaded as a Prado application module
$cache->init(null);
$cache->add('object',$object);
$object2=$cache->get('object');
If loaded, TXCache will register itself with {@link TApplication} as the
cache module. It can be accessed via {@link TApplication::getCache()}.
TXCache may be configured in application configuration file as follows
Показать файл
Открыть проект
Открытые методы
Метод |
Описание |
|
flush ( ) |
Deletes all values from cache. |
|
init ( $config ) |
Initializes this module. |
|
Защищенные методы
Метод |
Описание |
|
addValue ( $key, $value, $expire ) : boolean |
Stores a value identified by a key into cache if the cache does not contain this key. |
|
deleteValue ( $key ) : boolean |
Deletes a value with the specified key from cache
This is the implementation of the method declared in the parent class. |
|
getValue ( $key ) : string |
Retrieves a value from cache with a specified key. |
|
setValue ( $key, $value, $expire ) : boolean |
Stores a value identified by a key in cache. |
|
Описание методов
addValue()
защищенный Метод
This is the implementation of the method declared in the parent class.
protected addValue ( $key, $value, $expire ) : boolean |
Результат |
boolean |
true if the value is successfully stored into cache, false otherwise |
deleteValue()
защищенный Метод
Deletes a value with the specified key from cache
This is the implementation of the method declared in the parent class.
Be careful of performing this operation if the cache is shared by multiple applications.
getValue()
защищенный Метод
This is the implementation of the method declared in the parent class.
protected getValue ( $key ) : string |
Результат |
string |
the value stored in cache, false if the value is not in the cache or expired. |
This method is required by the IModule interface.
setValue()
защищенный Метод
This is the implementation of the method declared in the parent class.
protected setValue ( $key, $value, $expire ) : boolean |
Результат |
boolean |
true if the value is successfully stored into cache, false otherwise |