Class \Prado\Caching\TAPCCache
TAPCCache implements a cache application module based on APCu.
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 APCu PHP extension must be loaded and set in the php.ini file.
Some usage examples of TAPCCache are as follows,
$cache=new TAPCCache; // TAPCCache may also be loaded as a Prado application module
$cache->init(null);
$cache->add('object',$object);
$object2=$cache->get('object');
If loaded, TAPCCache will register itself with TApplication as the cache module. It can be accessed via TApplication::getCache().
TAPCCache may be configured in application configuration file as follows
<module id="cache" class="Prado\Caching\TAPCCache" />
Class hierarchy
- \Prado\Caching\TAPCCache
- \Prado\Caching\TCache implements ICache, ArrayAccess
- \Prado\TModule implements IModule
- \Prado\TApplicationComponent
- \Prado\TComponent
Author: Knut Urdalen <knut.urdalen@gmail.com>
Since: 3.0b
public
|
flush() : bool
Deletes all values from cache.
Be careful of performing this operation if the cache is shared by multiple applications. |
public
|
init(TXmlElement $config) : mixed
Initializes this module.
This method is required by the IModule interface. |
protected
|
addValue(string $key, string $value, int $expire) : bool
Stores a value identified by a key into cache if the cache does not contain this key.
This is the implementation of the method declared in the parent class. |
protected
|
deleteValue(string $key) : bool
Deletes a value with the specified key from cache
This is the implementation of the method declared in the parent class.
|
protected
|
getValue(string $key) : false|string
Retrieves a value from cache with a specified key.
This is the implementation of the method declared in the parent class. |
protected
|
setValue(string $key, string $value, int $expire) : bool
Stores a value identified by a key in cache.
This is the implementation of the method declared in the parent class. |
\Prado\TApplicationComponent::FX_CACHE_FILE, \Prado\TComponent::GLOBAL_RAISE_EVENT_LISTENER |