Class Zend_Cache_Core

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

Located in /Cache/Core.php (line 28)


	
			
Direct descendents
Variable Summary
Method Summary
 static void _validateIdOrTag (string $string)
 static void _validateTagsArray (array $tags)
 void __construct ([array|Zend_Config $options = array()])
 boolean clean ([string $mode = 'all'], [array|string $tags = array()])
 object backend getBackend ()
 array getIds ()
 array getIdsMatchingTags ([array $tags = array()])
 array getIdsNotMatchingTags ([array $tags = array()])
 array getMetadatas (string $id)
 mixed getOption (string $name)
 array getTags ()
 mixed|false load (string $id, [boolean $doNotTestCacheValidity = false], [boolean $doNotUnserialize = false])
 boolean remove (string $id)
 boolean save (mixed $data, [string $id = null], [array $tags = array()], [int $specificLifetime = false], [int $priority = 8])
 void setBackend (Zend_Cache_Backend $backendObject)
 void setLifetime (int $newLifetime)
 void setOption (string $name, mixed $value)
 int|false test (string $id)
 boolean touch (string $id, int $extraLifetime)
 string _id (string $id)
 void _log (string $message, [ $priority = 4])
 void _loggerSanity ()
Variables
static array $_directivesList = array('lifetime', 'logging', 'logger') (line 94)

Array of options which have to be transfered to backend

  • access: protected
object $_backend = null (line 35)

Backend Object

  • access: protected
array $_backendCapabilities = array() (line 122)

Array of capabilities of the backend (only if it implements Zend_Cache_Backend_ExtendedInterface)

  • access: protected
boolean $_extendedBackend = false (line 115)

True if the backend implements Zend_Cache_Backend_ExtendedInterface

  • access: protected
array $_options = array(
'write_control' => true,
'caching' => true,
'cache_id_prefix' => null,
'automatic_serialization' => false,
'automatic_cleaning_factor' => 10,
'lifetime' => 3600,
'logging' => false,
'logger' => null,
'ignore_user_abort' => false
)
(line 77)

Available options

====> (boolean) write_control :

  • Enable / disable write control (the cache is read just after writing to detect corrupt entries)
  • Enable write control will lightly slow the cache writing but not the cache reading
Write control can detect some corrupt cache files but maybe it's not a perfect control

====> (boolean) caching :

  • Enable / disable caching
(can be very useful for the debug of cached scripts)

=====> (string) cache_id_prefix :

  • prefix for cache ids (namespace)
====> (boolean) automatic_serialization :
  • Enable / disable automatic serialization
  • It can be used to save directly datas which aren't strings (but it's slower)
====> (int) automatic_cleaning_factor :
  • Disable / Tune the automatic cleaning process
  • The automatic cleaning process destroy too old (for the given life time) cache files when a new cache file is written : 0 => no automatic cache cleaning 1 => systematic cache cleaning x (integer) > 1 => automatic cleaning randomly 1 times on x cache write
====> (int) lifetime :
  • Cache lifetime (in seconds)
  • If null, the cache is valid forever.
====> (boolean) logging :
  • If set to true, logging is activated (but the system is slower)
====> (boolean) ignore_user_abort
  • If set to true, the core will set the ignore_user_abort PHP flag inside the save() method to avoid cache corruptions in some cases (default false)

  • var: available options
  • access: protected
array $_specificOptions = array() (line 101)

Not used for the core, just a sort a hint to get a common setOption() method (for the core and for frontends)

  • access: protected

Redefined in descendants as:
Methods
static _validateIdOrTag (line 591)

Validate a cache id or a tag (security, reliable filenames, reserved prefixes...)

Throw an exception if a problem is found

  • throws: Zend_Cache_Exception
  • access: protected
static void _validateIdOrTag (string $string)
  • string $string: Cache id or tag
static _validateTagsArray (line 613)

Validate a tags array (security, reliable filenames, reserved prefixes...)

Throw an exception if a problem is found

  • throws: Zend_Cache_Exception
  • access: protected
static void _validateTagsArray (array $tags)
  • array $tags: Array of tags
Constructor __construct (line 131)

Constructor

  • throws: Zend_Cache_Exception
  • access: public
void __construct ([array|Zend_Config $options = array()])
  • array|Zend_Config $options: Associative array of options or Zend_Config instance

Redefined in descendants as:
clean (line 439)

Clean cache entries

Available modes are : 'all' (default) => remove all cache entries ($tags is not used) 'old' => remove too old cache entries ($tags is not used) 'matchingTag' => remove cache entries matching all given tags ($tags can be an array of strings or a single string) 'notMatchingTag' => remove cache entries not matching one of the given tags ($tags can be an array of strings or a single string) 'matchingAnyTag' => remove cache entries matching any given tags ($tags can be an array of strings or a single string)

  • return: True if ok
  • throws: Zend_Cache_Exception
  • access: public
boolean clean ([string $mode = 'all'], [array|string $tags = array()])
  • string $mode
  • array|string $tags
getBackend (line 190)

Returns the backend

  • return: object
  • access: public
object backend getBackend ()
getFillingPercentage (line 538)

Return the filling percentage of the backend storage

  • return: integer between 0 and 100
  • access: public
int getFillingPercentage ()
getIds (line 498)

Return an array of stored cache ids

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

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
getIdsNotMatchingTags (line 482)

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
getMetadatas (line 557)

Return an array of metadatas for the given cache id

The array will 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
getOption (line 230)

Public frontend to get an option value

  • return: option value
  • throws: Zend_Cache_Exception
  • access: public
mixed getOption (string $name)
  • string $name: Name of the option
getTags (line 522)

Return an array of stored tags

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

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

  • return: Cached datas
  • access: public
mixed|false load (string $id, [boolean $doNotTestCacheValidity = false], [boolean $doNotUnserialize = false])
  • string $id: Cache id
  • boolean $doNotTestCacheValidity: If set to true, the cache validity won't be tested
  • boolean $doNotUnserialize: Do not serialize (even if automatic_serialization is true) => for internal use

Redefined in descendants as:
remove (line 411)

Remove a cache

  • return: True if ok
  • access: public
boolean remove (string $id)
  • string $id: Cache id to remove
save (line 334)

Save some data in a cache

  • return: True if no problem
  • throws: Zend_Cache_Exception
  • access: public
boolean save (mixed $data, [string $id = null], [array $tags = array()], [int $specificLifetime = false], [int $priority = 8])
  • mixed $data: Data to put in cache (can be another type than string if automatic_serialization is on)
  • string $id: Cache id (if not set, the last cache id will be used)
  • array $tags: Cache tags
  • int $specificLifetime: If != false, set a specific lifetime for this cache record (null => infinite lifetime)
  • int $priority: integer between 0 (very low priority) and 10 (maximum priority) used by some particular backends
setBackend (line 168)

Set the backend

  • throws: Zend_Cache_Exception
  • access: public
void setBackend (Zend_Cache_Backend $backendObject)
  • object $backendObject
setConfig (line 152)

Set options using an instance of type Zend_Config

  • access: public
Zend_Cache_Core setConfig ( $config)
setLifetime (line 270)

Force a new lifetime

The new value is set for the core/frontend but for the backend too (directive)

  • access: public
void setLifetime (int $newLifetime)
  • int $newLifetime: New lifetime (in seconds)
setOption (line 205)

Public frontend to set an option

There is an additional validation (relatively to the protected _setOption method)

  • throws: Zend_Cache_Exception
  • access: public
void setOption (string $name, mixed $value)
  • string $name: Name of the option
  • mixed $value: Value of the option

Redefined in descendants as:
test (line 312)

Test if a cache is available for the given id

  • return: Last modified time of cache entry if it is available, false otherwise
  • access: public
int|false test (string $id)
  • string $id: Cache id

Redefined in descendants as:
touch (line 573)

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
_id (line 675)

Make and return a cache id

Checks 'cache_id_prefix' and returns new id with prefix or simply the id if null

  • return: Cache id (with or without prefix)
  • access: protected
string _id (string $id)
  • string $id: Cache id
_log (line 655)

Log a message at the WARN (4) priority.

  • throws: Zend_Cache_Exception
  • access: protected
void _log (string $message, [ $priority = 4])
  • string $message
  • $priority
_loggerSanity (line 632)

Make sure if we enable logging that the Zend_Log class is available.

Create a default log object if none is set.

  • throws: Zend_Cache_Exception
  • access: protected
void _loggerSanity ()

Documentation generated on Thu, 01 Apr 2010 13:00:40 -0400 by phpDocumentor 1.4.3