Class Zend_Cache_Backend_Memcached

Description

Implements interfaces:

  • copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  • license: New BSD License

Located in /Cache/Backend/Memcached.php (line 41)

Zend_Cache_Backend
   |
   --Zend_Cache_Backend_Memcached
Class Constant Summary
 DEFAULT_HOST = '127.0.0.1'
 DEFAULT_PORT = 11211
 TAGS_UNSUPPORTED_BY_CLEAN_OF_MEMCACHED_BACKEND = 'Zend_Cache_Backend_Memcached::clean() : tags are unsupported by the Memcached backend'
 TAGS_UNSUPPORTED_BY_SAVE_OF_MEMCACHED_BACKEND = 'Zend_Cache_Backend_Memcached::save() : tags are unsupported by the Memcached backend'
Variable Summary
 mixed $_memcache
 array $_options
Method Summary
 void __construct ([ $options = array()])
 boolean clean ([string $mode = Zend_Cache::CLEANING_MODE_ALL], [array $tags = array()])
 array getCapabilities ()
 array getIds ()
 array getIdsMatchingAnyTags ([array $tags = array()])
 array getIdsMatchingTags ([array $tags = array()])
 array getIdsNotMatchingTags ([array $tags = array()])
 array getMetadatas (string $id)
 array getTags ()
 string|false load (string $id, [boolean $doNotTestCacheValidity = false])
 boolean remove (string $id)
 boolean save (string $data, string $id, [array $tags = array()], [int $specificLifetime = false])
 void setDirectives (array $directives)
 mixed|false test (string $id)
 boolean touch (string $id, int $extraLifetime)
Variables
mixed $_memcache = null (line 111)

Memcache object

  • var: memcache object
  • access: protected
array $_options = array(
'servers' => array(array(
'host' => self::DEFAULT_HOST,
'port' => self::DEFAULT_PORT,
'persistent' => self::DEFAULT_PERSISTENT,
'weight' => self::DEFAULT_WEIGHT,
'timeout' => self::DEFAULT_TIMEOUT,
'retry_interval' => self::DEFAULT_RETRY_INTERVAL,
'status' => self::DEFAULT_STATUS,
'failure_callback' => self::DEFAULT_FAILURE_CALLBACK
)),'compression'=>false,'compatibility'=>false,)
(line 91)

Available options

=====> (array) servers : an array of memcached server ; each memcached server is described by an associative array : 'host' => (string) : the name of the memcached server 'port' => (int) : the port of the memcached server 'persistent' => (bool) : use or not persistent connections to this memcached server 'weight' => (int) : number of buckets to create for this server which in turn control its probability of it being selected. The probability is relative to the total weight of all servers. 'timeout' => (int) : value in seconds which will be used for connecting to the daemon. Think twice before changing the default value of 1 second - you can lose all the advantages of caching if your connection is too slow. 'retry_interval' => (int) : controls how often a failed server will be retried, the default value is 15 seconds. Setting this parameter to -1 disables automatic retry. 'status' => (bool) : controls if the server should be flagged as online. 'failure_callback' => (callback) : Allows the user to specify a callback function to run upon encountering an error. The callback is run before failover is attempted. The function takes two parameters, the hostname and port of the failed server.

=====> (boolean) compression : true if you want to use on-the-fly compression

=====> (boolean) compatibility : true if you use old memcache server or extension

  • var: available options
  • access: protected

Redefinition of:
Zend_Cache_Backend::$_options
Available options

Inherited Variables

Inherited from Zend_Cache_Backend

Zend_Cache_Backend::$_directives
Methods
Constructor __construct (line 120)

Constructor

  • throws: Zend_Cache_Exception
  • access: public
void __construct ([ $options = array()])
  • array $options: associative array of options

Redefinition of:
Zend_Cache_Backend::__construct()
Constructor
clean (line 259)

Clean some cache records

Available modes are : 'all' (default) => remove all cache entries ($tags is not used) 'old' => unsupported 'matchingTag' => unsupported 'notMatchingTag' => unsupported 'matchingAnyTag' => unsupported

  • return: True if no problem
  • throws: Zend_Cache_Exception
  • access: public
boolean clean ([string $mode = Zend_Cache::CLEANING_MODE_ALL], [array $tags = array()])
  • string $mode: Clean mode
  • array $tags: Array of tags

Implementation of:
Zend_Cache_Backend_Interface::clean()
Clean some cache records
getCapabilities (line 492)

Return an associative array of capabilities (booleans) of the backend

The array must include these keys :

  • automatic_cleaning (is automating cleaning necessary)
  • tags (are tags supported)
  • expired_read (is it possible to read expired cache records (for doNotTestCacheValidity option for example))
  • priority does the backend deal with priority when saving
  • infinite_lifetime (is infinite lifetime can work with this backend)
  • get_list (is it possible to get the list of cache ids and the complete list of tags)

  • return: associative of with capabilities
  • access: public
array getCapabilities ()

Implementation of:
Zend_Cache_Backend_ExtendedInterface::getCapabilities()
Return an associative array of capabilities (booleans) of the backend
getFillingPercentage (line 380)

Return the filling percentage of the backend storage

  • return: integer between 0 and 100
  • throws: Zend_Cache_Exception
  • access: public
int getFillingPercentage ()

Implementation of:
Zend_Cache_Backend_ExtendedInterface::getFillingPercentage()
Return the filling percentage of the backend storage
getIds (line 315)

Return an array of stored cache ids

  • return: array of stored cache ids (string)
  • access: public
array getIds ()

Implementation of:
Zend_Cache_Backend_ExtendedInterface::getIds()
Return an array of stored cache ids
getIdsMatchingAnyTags (line 368)

Return an array of stored cache ids which match any given tags

In case of multiple tags, a logical AND is made between tags

  • return: array of any matching cache ids (string)
  • access: public
array getIdsMatchingAnyTags ([array $tags = array()])
  • array $tags: array of tags

Implementation of:
Zend_Cache_Backend_ExtendedInterface::getIdsMatchingAnyTags()
Return an array of stored cache ids which match any given tags
getIdsMatchingTags (line 340)

Return an array of stored cache ids which match given tags

In case of multiple tags, a logical AND is made between tags

  • return: array of matching cache ids (string)
  • access: public
array getIdsMatchingTags ([array $tags = array()])
  • array $tags: array of tags

Implementation of:
Zend_Cache_Backend_ExtendedInterface::getIdsMatchingTags()
Return an array of stored cache ids which match given tags
getIdsNotMatchingTags (line 354)

Return an array of stored cache ids which don't match given tags

In case of multiple tags, a logical OR is made between tags

  • return: array of not matching cache ids (string)
  • access: public
array getIdsNotMatchingTags ([array $tags = array()])
  • array $tags: array of tags

Implementation of:
Zend_Cache_Backend_ExtendedInterface::getIdsNotMatchingTags()
Return an array of stored cache ids which don't match given tags
getMetadatas (line 420)

Return an array of metadatas for the given cache id

The array must include these keys :

  • expire : the expire timestamp
  • tags : a string array of tags
  • mtime : timestamp of last modification time

  • return: array of metadatas (false if the cache id is not found)
  • access: public
array getMetadatas (string $id)
  • string $id: cache id

Implementation of:
Zend_Cache_Backend_ExtendedInterface::getMetadatas()
Return an array of metadatas for the given cache id
getTags (line 326)

Return an array of stored tags

  • return: array of stored tags (string)
  • access: public
array getTags ()

Implementation of:
Zend_Cache_Backend_ExtendedInterface::getTags()
Return an array of stored tags
isAutomaticCleaningAvailable (line 284)

Return true if the automatic cleaning is available for the backend

  • access: public
boolean isAutomaticCleaningAvailable ()

Redefinition of:
Zend_Cache_Backend::isAutomaticCleaningAvailable()
Return true if the automatic cleaning is available for the backend
load (line 178)

Test if a cache is available for the given id and (if yes) return it (false else)

  • return: cached datas
  • access: public
string|false load (string $id, [boolean $doNotTestCacheValidity = false])
  • string $id: Cache id
  • boolean $doNotTestCacheValidity: If set to true, the cache validity won't be tested

Implementation of:
Zend_Cache_Backend_Interface::load()
Test if a cache is available for the given id and (if yes) return it (false else)
remove (line 239)

Remove a cache record

  • return: True if no problem
  • access: public
boolean remove (string $id)
  • string $id: Cache id

Implementation of:
Zend_Cache_Backend_Interface::remove()
Remove a cache record
save (line 214)

Save some string datas into a cache record

Note : $data is always "string" (serialization is done by the core not by the backend)

  • return: True if no problem
  • access: public
boolean save (string $data, string $id, [array $tags = array()], [int $specificLifetime = false])
  • string $data: Datas to cache
  • string $id: Cache id
  • array $tags: Array of strings, the cache record will be tagged by each string entry
  • int $specificLifetime: If != false, set a specific lifetime for this cache record (null => infinite lifetime)

Implementation of:
Zend_Cache_Backend_Interface::save()
Save some string datas into a cache record
setDirectives (line 296)

Set the frontend directives

  • throws: Zend_Cache_Exception
  • access: public
void setDirectives (array $directives)
  • array $directives: Assoc of directives

Redefinition of:
Zend_Cache_Backend::setDirectives()
Set the frontend directives

Implementation of:
Zend_Cache_Backend_Interface::setDirectives()
Set the frontend directives
test (line 193)

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

  • return: (a cache is not available) or "last modified" timestamp (int) of the available cache record
  • access: public
mixed|false test (string $id)
  • string $id: Cache id

Implementation of:
Zend_Cache_Backend_Interface::test()
Test if a cache is available or not (for the given id)
touch (line 448)

Give (if possible) an extra lifetime to the given cache id

  • return: true if ok
  • access: public
boolean touch (string $id, int $extraLifetime)
  • string $id: cache id
  • int $extraLifetime

Implementation of:
Zend_Cache_Backend_ExtendedInterface::touch()
Give (if possible) an extra lifetime to the given cache id

Inherited Methods

Inherited From Zend_Cache_Backend

 Zend_Cache_Backend::__construct()
 Zend_Cache_Backend::getLifetime()
 Zend_Cache_Backend::getTmpDir()
 Zend_Cache_Backend::isAutomaticCleaningAvailable()
 Zend_Cache_Backend::setDirectives()
 Zend_Cache_Backend::setOption()
 Zend_Cache_Backend::_isGoodTmpDir()
 Zend_Cache_Backend::_log()
 Zend_Cache_Backend::_loggerSanity()
Class Constants
DEFAULT_FAILURE_CALLBACK = null (line 53)
DEFAULT_HOST = '127.0.0.1' (line 46)

Default Values

DEFAULT_PERSISTENT = true (line 48)
DEFAULT_PORT = 11211 (line 47)
DEFAULT_RETRY_INTERVAL = 15 (line 51)
DEFAULT_STATUS = true (line 52)
DEFAULT_TIMEOUT = 1 (line 50)
DEFAULT_WEIGHT = 1 (line 49)
TAGS_UNSUPPORTED_BY_CLEAN_OF_MEMCACHED_BACKEND = 'Zend_Cache_Backend_Memcached::clean() : tags are unsupported by the Memcached backend' (line 58)

Log message

TAGS_UNSUPPORTED_BY_SAVE_OF_MEMCACHED_BACKEND = 'Zend_Cache_Backend_Memcached::save() : tags are unsupported by the Memcached backend' (line 59)

Documentation generated on Mon, 21 Jun 2010 15:33:35 -0400 by phpDocumentor 1.4.3