Memcached storage engine for cache. Memcached has some limitations in the amount of control you have over expire times far in the future. See MemcachedEngine::write() for more information.
Main advantage of this Memcached engine over the memcached engine is support of binary protocol, and igbibnary serialization (if memcached extension compiled with --enable-igbinary) Compressed keys can also be incremented/decremented
This cache engine requires at least ext/memcached version 2.0
$_Memcached
protected Memcache
$_serializers
protected array
$settings
public array
Parses the server address into the host/port. Handles both IPv6 and IPv4 addresses and Unix sockets
Write data for key into cache if it doesn't exist already. When using memcached as your cache engine remember that the Memcached pecl extension does not support cache expiry times greater than 30 days in the future. Any duration greater than 30 days will be treated as never expiring. If it already exists, it fails and returns false.
Increments the group value to simulate deletion of all keys under a group old values will remain in storage until they expire.
Returns the group value
for each of the configured groups If the group initial value was not found, then it initializes the group accordingly.
Write data for key into cache. When using memcached as your cache engine remember that the Memcached PECL extension does not support cache expiry times greater than 30 days in the future. Any duration greater than 30 days will be treated as never expiring.
_parseServerString( string $server )
Parses the server address into the host/port. Handles both IPv6 and IPv4 addresses and Unix sockets
$server
_setOptions( )
Settings the memcached instance
CacheException
add( string $key , mixed $value , integer $duration )
Write data for key into cache if it doesn't exist already. When using memcached as your cache engine remember that the Memcached pecl extension does not support cache expiry times greater than 30 days in the future. Any duration greater than 30 days will be treated as never expiring. If it already exists, it fails and returns false.
$key
$value
$duration
CacheEngine::add()
clear( boolean $check )
Delete all keys from the cache
$check
If true no deletes will occur and instead CakePHP will rely on key TTL values.
True if the cache was successfully cleared, false otherwise. Will also return false if you are using a binary protocol.
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.
$group
CacheEngine::clearGroup()
decrement( string $key , integer $offset 1 )
Decrements the value of an integer cached key
$key
$offset
optional 1 CacheException
delete( string $key )
Delete a key from the cache
$key
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.
CacheEngine::groups()
increment( string $key , integer $offset 1 )
Increments the value of an integer cached key
$key
$offset
optional 1 CacheException
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());
$settings
optional array() CacheException
CacheEngine::init()
read( string $key )
Read a key from the cache
$key
write( string $key , mixed $value , integer $duration )
Write data for key into cache. When using memcached as your cache engine remember that the Memcached PECL extension does not support cache expiry times greater than 30 days in the future. Any duration greater than 30 days will be treated as never expiring.
$key
$value
$duration
gc( integer $expires null )
Garbage collection
Permanently remove all expired and deleted data
$expires
optional null key( string $key )
Generates a safe key for use with cache engine storage engines.
$key
protected array
List of available serializer engines
Memcached must be compiled with json and igbinary support to use these engines
array( 'igbinary' => Memcached::SERIALIZER_IGBINARY, 'json' => Memcached::SERIALIZER_JSON, 'php' => Memcached::SERIALIZER_PHP )
public array
Settings
array()
© 2005–2016 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.9/class-MemcachedEngine.html