Zend Framework  1.12
Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Zend_Cache_Backend_Static Class Reference

Public Member Functions

 setOption ($name, $value)
 Interceptor child method to handle the case where an Inner Cache object is being set since it's not supported by the standard backend interface.
 
 getOption ($name)
 Retrieve any option via interception of the parent's statically held options including the local option for a tag cache.
 
 load ($id, $doNotTestCacheValidity=false)
 Test if a cache is available for the given id and (if yes) return it (false else)
 
 test ($id)
 Test if a cache is available or not (for the given id)
 
 save ($data, $id, $tags=array(), $specificLifetime=false)
 Save some string datas into a cache record.
 
 remove ($id)
 Remove a cache record.
 
 removeRecursively ($id)
 Remove a cache record recursively for the given directory matching a REQUEST_URI based relative path (deletes the actual file matching this in addition to the matching directory)
 
 clean ($mode=Zend_Cache::CLEANING_MODE_ALL, $tags=array())
 Clean some cache records.
 
 setInnerCache (Zend_Cache_Core $cache)
 Set an Inner Cache, used here primarily to store Tags associated with caches created by this backend.
 
 getInnerCache ()
 Get the Inner Cache if set.
 
- Public Member Functions inherited from Zend_Cache_Backend
 __construct (array $options=array())
 Constructor.
 
 setDirectives ($directives)
 Set the frontend directives.
 
 setOption ($name, $value)
 Set an option.
 
 getOption ($name)
 Returns an option.
 
 getLifetime ($specificLifetime)
 Get the life time.
 
 isAutomaticCleaningAvailable ()
 Return true if the automatic cleaning is available for the backend.
 
 getTmpDir ()
 Determine system TMP directory and detect if we have read access.
 
- Public Member Functions inherited from Zend_Cache_Backend_Interface
 setDirectives ($directives)
 Set the frontend directives.
 

Public Attributes

const INNER_CACHE_NAME = 'zend_cache_backend_static_tagcache'
 

Protected Member Functions

 _createDirectoriesFor ($path)
 Recursively create the directories needed to write the static file.
 
 _isSerialized ($data)
 Detect serialization of data (cannot predict since this is the only way to obey the interface yet pass in another parameter).
 
 _verifyPath ($path)
 Verify path exists and is non-empty.
 
 _detectId ()
 Determine the page to save from the request.
 
 _octdec ($val)
 Detect an octal string and return its octal value for file permission ops otherwise return the non-string (assumed octal or decimal int already)
 
 _decodeId ($id)
 Decode a request URI from the provided ID.
 
- Protected Member Functions inherited from Zend_Cache_Backend
 _isGoodTmpDir ($dir)
 Verify if the given temporary directory is readable and writable.
 
 _loggerSanity ()
 Make sure if we enable logging that the Zend_Log class is available.
 
 _log ($message, $priority=4)
 Log a message at the WARN (4) priority.
 

Static Protected Member Functions

static _validateIdOrTag ($string)
 Validate a cache id or a tag (security, reliable filenames, reserved prefixes...)
 

Protected Attributes

 $_options
 
 $_tagCache = null
 
 $_tagged = null
 
- Protected Attributes inherited from Zend_Cache_Backend
 $_directives
 
 $_options = array()
 

Member Function Documentation

_createDirectoriesFor (   $path)
protected

Recursively create the directories needed to write the static file.

_decodeId (   $id)
protected

Decode a request URI from the provided ID.

Parameters
string$id
Returns
string
_detectId ( )
protected

Determine the page to save from the request.

Returns
string
_isSerialized (   $data)
protected

Detect serialization of data (cannot predict since this is the only way to obey the interface yet pass in another parameter).

In future, ZF 2.0, check if we can just avoid the interface restraints.

This format is the only valid one possible for the class, so it's simple to just run a regular expression for the starting serialized format.

_octdec (   $val)
protected

Detect an octal string and return its octal value for file permission ops otherwise return the non-string (assumed octal or decimal int already)

Parameters
string$valThe potential octal in need of conversion
Returns
int
static _validateIdOrTag (   $string)
staticprotected

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

Throw an exception if a problem is found

Parameters
string$stringCache id or tag
Exceptions
Zend_Cache_Exception
Returns
void
Deprecated:
Not usable until perhaps ZF 2.0
_verifyPath (   $path)
protected

Verify path exists and is non-empty.

Parameters
string$path
Returns
bool
clean (   $mode = Zend_Cache::CLEANING_MODE_ALL,
  $tags = array() 
)

Clean some cache records.

Available modes are : Zend_Cache::CLEANING_MODE_ALL (default) => remove all cache entries ($tags is not used) Zend_Cache::CLEANING_MODE_OLD => remove too old cache entries ($tags is not used) Zend_Cache::CLEANING_MODE_MATCHING_TAG => remove cache entries matching all given tags ($tags can be an array of strings or a single string) Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG => remove cache entries not {matching one of the given tags} ($tags can be an array of strings or a single string) Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG => remove cache entries matching any given tags ($tags can be an array of strings or a single string)

Parameters
string$modeClean mode
array$tagsArray of tags
Returns
boolean true if no problem

Implements Zend_Cache_Backend_Interface.

getInnerCache ( )

Get the Inner Cache if set.

Returns
Zend_Cache_Core
getOption (   $name)

Retrieve any option via interception of the parent's statically held options including the local option for a tag cache.

Parameters
string$name
Returns
mixed
load (   $id,
  $doNotTestCacheValidity = false 
)

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

Note : return value is always "string" (unserialization is done by the core not by the backend)

Parameters
string$idCache id
boolean$doNotTestCacheValidityIf set to true, the cache validity won't be tested
Returns
string|false cached datas

Implements Zend_Cache_Backend_Interface.

remove (   $id)

Remove a cache record.

Parameters
string$idCache id
Returns
boolean True if no problem

Implements Zend_Cache_Backend_Interface.

removeRecursively (   $id)

Remove a cache record recursively for the given directory matching a REQUEST_URI based relative path (deletes the actual file matching this in addition to the matching directory)

Parameters
string$idCache id
Returns
boolean True if no problem
save (   $data,
  $id,
  $tags = array(),
  $specificLifetime = false 
)

Save some string datas into a cache record.

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

Parameters
string$dataDatas to cache
string$idCache id
array$tagsArray of strings, the cache record will be tagged by each string entry
int$specificLifetimeIf != false, set a specific lifetime for this cache record (null => infinite lifetime)
Returns
boolean true if no problem

Implements Zend_Cache_Backend_Interface.

setInnerCache ( Zend_Cache_Core  $cache)

Set an Inner Cache, used here primarily to store Tags associated with caches created by this backend.

Note: If Tags are lost, the cache should be completely cleaned as the mapping of tags to caches will have been irrevocably lost.

Parameters
Zend_Cache_Core
Returns
void
setOption (   $name,
  $value 
)

Interceptor child method to handle the case where an Inner Cache object is being set since it's not supported by the standard backend interface.

Parameters
string$name
mixed$value
Returns
Zend_Cache_Backend_Static
test (   $id)

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

Parameters
string$idcache id
Returns
bool

Implements Zend_Cache_Backend_Interface.

Member Data Documentation

$_options
protected
Initial value:
= array(
'public_dir' => null,
'sub_dir' => 'html',
'file_extension' => '.html',
'index_filename' => 'index',
'file_locking' => true,
'cache_file_perm' => 0600,
'cache_directory_perm' => 0700,
'debug_header' => false,
'tag_cache' => null,
'disable_caching' => false
)
$_tagCache = null
protected
$_tagged = null
protected
const INNER_CACHE_NAME = 'zend_cache_backend_static_tagcache'