Class XcacheEngine
Xcache storage engine for cache
- CacheEngine
- XcacheEngine
Link: Xcache
Copyright: Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
License: MIT License
Location: Cake/Cache/Engine/XcacheEngine.php
Properties summary
-
$settings
publicSettingsarray
Inherited Properties
Method Summary
- _auth() protected
Populates and reverses $_SERVER authentication values Makes necessary changes (and reverting them back) in $_SERVER
- add() public
Write data for key into cache if it doesn't exist already. If it already exists, it fails and returns false.
- clear() publicDelete all keys from the cache
- clearGroup() public
Increments the group value to simulate deletion of all keys under a group old values will remain in storage until they expire.
- decrement() public
Decrements the value of an integer cached key. If the cache key is not an integer it will be treated as 0
- delete() publicDelete a key from the cache
- groups() public
Returns the
group value
for each of the configured groups If the group initial value was not found, then it initializes the group accordingly. - increment() public
Increments the value of an integer cached key If the cache key is not an integer it will be treated as 0
- init() publicInitialize the Cache Engine
- read() publicRead a key from the cache
- write() publicWrite data for key into cache
Method Detail
_auth()source protected
_auth( boolean $reverse false )
Populates and reverses $_SERVER authentication values Makes necessary changes (and reverting them back) in $_SERVER
This has to be done because xcache_clear_cache() needs to pass Basic Http Auth (see xcache.admin configuration settings)
Parameters
- boolean
$reverse
optional false - Revert changes
add()source public
add( string $key , mixed $value , integer $duration )
Write data for key into cache if it doesn't exist already. If it already exists, it fails and returns false.
Parameters
- string
$key
- Identifier for the data.
- mixed
$value
- Data to be cached.
- integer
$duration
- How long to cache the data, in seconds.
Returns
booleanTrue if the data was successfully cached, false on failure.
Overrides
CacheEngine::add()
clear()source public
clear( boolean $check )
Delete all keys from the cache
Parameters
- boolean
$check
If true no deletes will occur and instead CakePHP will rely on key TTL values.
Returns
booleanTrue if the cache was successfully cleared, false otherwise
clearGroup()source public
clearGroup( string $group )
Increments the group value to simulate deletion of all keys under a group old values will remain in storage until they expire.
Parameters
- string
$group
- The group to clear.
Returns
booleansuccess
Overrides
CacheEngine::clearGroup()
decrement()source public
decrement( string $key , integer $offset 1 )
Decrements the value of an integer cached key. If the cache key is not an integer it will be treated as 0
Parameters
- string
$key
- Identifier for the data
- integer
$offset
optional 1 - How much to subtract
Returns
Newdecremented value, false otherwise
delete()source public
delete( string $key )
Delete a key from the cache
Parameters
- string
$key
- Identifier for the data
Returns
booleanTrue if the value was successfully deleted, false if it didn't exist or couldn't be removed
groups()source public
groups( )
Returns the group value
for each of the configured groups If the group initial value was not found, then it initializes the group accordingly.
Returns
arrayOverrides
CacheEngine::groups()
increment()source public
increment( string $key , integer $offset 1 )
Increments the value of an integer cached key If the cache key is not an integer it will be treated as 0
Parameters
- string
$key
- Identifier for the data
- integer
$offset
optional 1 - How much to increment
Returns
Newincremented value, false otherwise
init()source public
init( array $settings array() )
Initialize the Cache Engine
Called automatically by the cache frontend To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
Parameters
- array
$settings
optional array() - array of setting for the engine
Returns
booleanTrue if the engine has been successfully initialized, false if not
Overrides
CacheEngine::init()
read()source public
read( string $key )
Read a key from the cache
Parameters
- string
$key
- Identifier for the data
Returns
mixedThe cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
write()source public
write( string $key , mixed $value , integer $duration )
Write data for key into cache
Parameters
- string
$key
- Identifier for the data
- mixed
$value
- Data to be cached
- integer
$duration
- How long to cache the data, in seconds
Returns
booleanTrue if the data was successfully cached, false on failure
Methods inherited from CacheEngine
gc()source public
gc( integer $expires null )
Garbage collection
Permanently remove all expired and deleted data
Parameters
- integer
$expires
optional null - [optional] An expires timestamp, invalidating all data before.
key()source public
key( string $key )
Generates a safe key for use with cache engine storage engines.
Parameters
- string
$key
- the key passed over
Returns
mixedstring $key or false
Properties detail
$settingssource
public array
Settings
- PHP_AUTH_USER = xcache.admin.user, default cake
- PHP_AUTH_PW = xcache.admin.password, default cake
array()
© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/2.10/class-XcacheEngine.html