MemcacheEngine Class Info:
- Class Declaration:
class MemcacheEngine extends CacheEngine
- File name:
- Cake/Cache/Engine/MemcacheEngine.php
- Description:
Memcache storage engine for cache. Memcache has some limitations in the amount of control you have over expire times far in the future. See MemcacheEngine::write() for more information.
- Class Inheritance
- Package
- Cake.Cache.Engine
Properties:
-
_Memcache Memcache
Memcache wrapper.
-
settings array
Settings
- servers = string or array of memcache servers, default => 127.0.0.1. If an array MemcacheEngine will use them as a pool.
- compress = boolean, default => false
clear
topDelete all keys from the cache
- Parameters:
-
-
boolean $check required
-
- Method defined in:
- Cake/Cache/Engine/MemcacheEngine.php on line 196
- Return
boolean True if the cache was successfully cleared, false otherwise
connect
topConnects to a server in connection pool
- Parameters:
-
-
string $host required
host ip address or name
-
integer $port optional 11211
Server port
-
- Method defined in:
- Cake/Cache/Engine/MemcacheEngine.php on line 228
- Return
boolean True if memcache server was connected
decrement
topDecrements the value of an integer cached key
- Parameters:
-
-
string $key required
Identifier for the data
-
integer $offset optional 1
How much to subtract
-
- Method defined in:
- Cake/Cache/Engine/MemcacheEngine.php on line 171
- Return
New decremented value, false otherwise
- Throws
CacheException when you try to decrement with compress = true
delete
topDelete a key from the cache
- Parameters:
-
-
string $key required
Identifier for the data
-
- Method defined in:
- Cake/Cache/Engine/MemcacheEngine.php on line 186
- Return
boolean True if the value was successfully deleted, false if it didn't exist or couldn't be removed
gc
topGarbage collection
Permanently remove all expired and deleted data
- Method defined in:
- Cake/Cache/CacheEngine.php on line 56
- Return
void
increment
topIncrements the value of an integer cached key
- Parameters:
-
-
string $key required
Identifier for the data
-
integer $offset optional 1
How much to increment
-
- Method defined in:
- Cake/Cache/Engine/MemcacheEngine.php on line 154
- Return
New incremented value, false otherwise
- Throws
CacheException when you try to increment with compress = true
init
topInitialize 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
-
- Method defined in:
- Cake/Cache/Engine/MemcacheEngine.php on line 57
- Return
boolean True if the engine has been successfully initialized, false if not
key
topGenerates a safe key for use with cache engine storage engines.
- Parameters:
-
-
string $key required
the key passed over
-
- Method defined in:
- Cake/Cache/CacheEngine.php on line 126
- Return
mixed string $key or false
_parseServerString
topParses the server address into the host/port. Handles both IPv6 and IPv4 addresses and Unix sockets
- Parameters:
-
-
string $server required
The server address string.
-
- Method defined in:
- Cake/Cache/Engine/MemcacheEngine.php on line 97
- Return
array Array containing host, port
read
topRead a key from the cache
- Parameters:
-
-
string $key required
Identifier for the data
-
- Method defined in:
- Cake/Cache/Engine/MemcacheEngine.php on line 142
- Return
mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
settings
topCache Engine settings
- Method defined in:
- Cake/Cache/CacheEngine.php on line 116
- Return
array settings
write
topWrite data for key into cache. When using memcache as your cache engine remember that the Memcache 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.
- Parameters:
-
-
string $key required
Identifier for the data
-
mixed $value required
Data to be cached
-
integer $duration required
How long to cache the data, in seconds
-
- Method defined in:
- Cake/Cache/Engine/MemcacheEngine.php on line 129
- Return
boolean True if the data was successfully cached, false on failure
- See
http://php.net/manual/en/memcache.set.php
