class Doctrine_Cache_Memcache extends Doctrine_Cache_Driver (View source)

Memcache cache driver

Properties

protected array $_options from Doctrine_Cache_Driver
protected Memcache $_memcache

Methods

__construct($options = array())

constructor

boolean
setOption(mixed $option, mixed $value)

Set option name and value

mixed
getOption(mixed $option)

Get value of option

mixed
fetch(string $id, boolean $testCacheValidity = true)

Fetch a cache record from this cache driver instance

mixed
contains(string $id)

Test if a cache record exists for the passed id

boolean
save(string $id, string $data, int $lifeTime = false)

Save some string datas into a cache record

boolean
delete(string $id)

Remove a cache record

integer
deleteByRegex(string $regex)

Delete cache entries where the key matches a PHP regular expressions

integer
deleteByPrefix(string $prefix)

Delete cache entries where the key has the passed prefix

integer
deleteBySuffix(string $suffix)

Delete cache entries where the key has the passed suffix

integer
deleteAll()

Delete all cache entries from the cache driver

string
_getKey(string $id)

Get the hash key passing its suffix

array
_getCacheKeys()

Fetch an array of all keys stored in cache

mixed
_doFetch(string $id, boolean $testCacheValidity = true)

Test if a cache record exists for the passed id

mixed
_doContains(string $id)

Test if a cache is available or not (for the given id)

boolean
_doSave(string $id, string $data, int $lifeTime = false)

Save a cache record directly. This method is implemented by the cache drivers and used in Doctrine_Cache_Driver::save()

boolean
_doDelete(string $id)

Remove a cache record directly. This method is implemented by the cache drivers and used in Doctrine_Cache_Driver::delete()

Details

__construct($options = array())

constructor

Parameters

$options

boolean setOption(mixed $option, mixed $value)

Set option name and value

Parameters

mixed $option the option name
mixed $value option value

Return Value

boolean TRUE on success, FALSE on failure

mixed getOption(mixed $option)

Get value of option

Parameters

mixed $option the option name

Return Value

mixed option value

mixed fetch(string $id, boolean $testCacheValidity = true)

Fetch a cache record from this cache driver instance

Parameters

string $id cache id
boolean $testCacheValidity if set to false, the cache validity won't be tested

Return Value

mixed Returns either the cached data or false

mixed contains(string $id)

Test if a cache record exists for the passed id

Parameters

string $id cache id

Return Value

mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record

boolean save(string $id, string $data, int $lifeTime = false)

Save some string datas into a cache record

Parameters

string $id cache id
string $data data to cache
int $lifeTime if != false, set a specific lifetime for this cache record (null => infinite lifeTime)

Return Value

boolean true if no problem

boolean delete(string $id)

Remove a cache record

Note: This method accepts wildcards with the * character

Parameters

string $id cache id

Return Value

boolean true if no problem

integer deleteByRegex(string $regex)

Delete cache entries where the key matches a PHP regular expressions

Parameters

string $regex

Return Value

integer $count The number of deleted cache entries

integer deleteByPrefix(string $prefix)

Delete cache entries where the key has the passed prefix

Parameters

string $prefix

Return Value

integer $count The number of deleted cache entries

integer deleteBySuffix(string $suffix)

Delete cache entries where the key has the passed suffix

Parameters

string $suffix

Return Value

integer $count The number of deleted cache entries

integer deleteAll()

Delete all cache entries from the cache driver

Return Value

integer $count The number of deleted cache entries

protected string _getKey(string $id)

Get the hash key passing its suffix

Parameters

string $id The hash key suffix

Return Value

string Hash key to be used by drivers

protected array _getCacheKeys()

Fetch an array of all keys stored in cache

Return Value

array Returns the array of cache keys

protected mixed _doFetch(string $id, boolean $testCacheValidity = true)

Test if a cache record exists for the passed id

Parameters

string $id cache id
boolean $testCacheValidity if set to false, the cache validity won't be tested

Return Value

mixed Returns either the cached data or false

protected mixed _doContains(string $id)

Test if a cache is available or not (for the given id)

Parameters

string $id cache id

Return Value

mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record

protected boolean _doSave(string $id, string $data, int $lifeTime = false)

Save a cache record directly. This method is implemented by the cache drivers and used in Doctrine_Cache_Driver::save()

Parameters

string $id cache id
string $data data to cache
int $lifeTime if != false, set a specific lifetime for this cache record (null => infinite lifeTime)

Return Value

boolean true if no problem

protected boolean _doDelete(string $id)

Remove a cache record directly. This method is implemented by the cache drivers and used in Doctrine_Cache_Driver::delete()

Parameters

string $id cache id

Return Value

boolean true if no problem