Class Zend_Cache_Backend_File

Description

Implements interfaces:

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

Located in /Zend/Cache/Backend/File.php (line 40)

Zend_Cache_Backend
   |
   --Zend_Cache_Backend_File
Variable Summary
array $_options
Method Summary
Zend_Cache_Backend_File __construct ([array $options = array()])
boolean clean ([string $mode = Zend_Cache::CLEANING_MODE_ALL], [mixed $tags = array()])
string get (string $id, [boolean $doNotTestCacheValidity = false])
boolean remove (string $id)
boolean save (string $data, string $id, [array $tags = array()])
void setCacheDir (mixed $value)
mixed test (string $id)
void ___expire (string $id)
Variables
array $_options = array(
'cacheDir' => '/tmp/',
'fileLocking' => true,
'readControl' => true,
'readControlType' => 'crc32',
'hashedDirectoryLevel' => 0,
'hashedDirectoryUmask' => 0700
)
(line 83)

Available options

=====> (string) cacheDir :

  • Directory where to put the cache files
=====> (boolean) fileLocking :
  • Enable / disable fileLocking
  • Can avoid cache corruption under bad circumstances but it doesn't work on multithread
webservers and on NFS filesystems for example

=====> (boolean) readControl :

  • Enable / disable read control
  • If enabled, a control key is embeded in cache file and this key is compared with the one
calculated after the reading.

=====> (string) readControlType :

  • Type of read control (only if read control is enabled). Available values are : 'md5' for a md5 hash control (best but slowest) 'crc32' for a crc32 hash control (lightly less safe but faster, better choice) 'strlen' for a length only test (fastest)
=====> (int) hashedDirectoryLevel :
  • Hashed directory level
  • Set the hashed directory structure level. 0 means "no hashed directory
structure", 1 means "one level of directory", 2 means "two levels"... This option can speed up the cache only when you have many thousands of cache file. Only specific benchs can help you to choose the perfect value for you. Maybe, 1 or 2 is a good start.

=====> (int) hashedDirectoryUmask :

  • Umask for hashed directory structure

  • 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 102)

Constructor

  • access: public
Zend_Cache_Backend_File __construct ([array $options = array()])
  • array $options: associative array of options

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

Clean some cache records

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)

  • return: true if no problem
  • access: public
boolean clean ([string $mode = Zend_Cache::CLEANING_MODE_ALL], [mixed $tags = array()])
  • string $mode: clean mode

Implementation of:
Zend_Cache_Backend_Interface::clean()
Clean some cache records
get (line 129)

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

  • return: cached datas (or false)
  • access: public
string get (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::get()
Test if a cache is available for the given id and (if yes) return it (false else)
remove (line 249)

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 202)

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()])
  • string $data: datas to cache
  • string $id: cache id
  • array $tags: array of strings, the cache record will be tagged by each string entry

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

Set the cacheDir (particular case of setOption() method)

  • access: public
void setCacheDir (mixed $value)
  • mixed $value
test (line 184)

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

  • return: false (a cache is not available) or "last modified" timestamp (int) of the available cache record
  • access: public
mixed 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)
___expire (line 285)

PUBLIC METHOD FOR UNIT TESTING ONLY !

Force a cache record to expire

  • access: public
void ___expire (string $id)
  • string $id: cache id

Inherited Methods

Inherited From Zend_Cache_Backend

Zend_Cache_Backend::__construct()
Zend_Cache_Backend::setDirectives()
Zend_Cache_Backend::setOption()

Documentation generated on Sun, 29 Oct 2006 21:27:14 -0600 by phpDocumentor 1.3.0RC6