Public Member Functions |
| __construct (array $options=array()) |
| setCacheDir ($value, $trailingSeparator=true) |
| load ($id, $doNotTestCacheValidity=false) |
| test ($id) |
| save ($data, $id, $tags=array(), $specificLifetime=false) |
| remove ($id) |
| clean ($mode=Zend_Cache::CLEANING_MODE_ALL, $tags=array()) |
| getIds () |
| getTags () |
| getIdsMatchingTags ($tags=array()) |
| getIdsNotMatchingTags ($tags=array()) |
| getIdsMatchingAnyTags ($tags=array()) |
| getFillingPercentage () |
| getMetadatas ($id) |
| touch ($id, $extraLifetime) |
| getCapabilities () |
| ___expire ($id) |
Protected Member Functions |
| _getMetadatas ($id) |
| _setMetadatas ($id, $metadatas, $save=true) |
| _delMetadatas ($id) |
| _cleanMetadatas () |
| _loadMetadatas ($id) |
| _saveMetadatas ($id, $metadatas) |
| _metadatasFile ($id) |
| _isMetadatasFile ($fileName) |
| _remove ($file) |
| _clean ($dir, $mode=Zend_Cache::CLEANING_MODE_ALL, $tags=array()) |
| _get ($dir, $mode, $tags=array()) |
| _expireTime ($lifetime) |
| _hash ($data, $controlType) |
| _idToFileName ($id) |
| _file ($id) |
| _path ($id, $parts=false) |
| _recursiveMkdirAndChmod ($id) |
| _test ($id, $doNotTestCacheValidity) |
| _fileGetContents ($file) |
| _filePutContents ($file, $string) |
| _fileNameToId ($fileName) |
Protected Attributes |
| $_options |
| $_metadatasArray = array() |
Detailed Description
Definition at line 40 of file File.php.
Constructor & Destructor Documentation
__construct |
( |
array $ |
options = array() ) |
|
Constructor
- Parameters:
-
array | $options | associative array of options |
- Exceptions:
-
- Returns:
- void
Reimplemented from Zend_Cache_Backend.
Definition at line 117 of file File.php.
Member Function Documentation
PUBLIC METHOD FOR UNIT TESTING ONLY !
Force a cache record to expire
- Parameters:
-
Definition at line 459 of file File.php.
Clean some cache records (protected method used for recursive stuff)
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 | $dir | Directory to clean |
string | $mode | Clean mode |
array | $tags | Array of tags |
- Exceptions:
-
- Returns:
- boolean True if no problem
Definition at line 641 of file File.php.
_cleanMetadatas |
( |
) |
[protected] |
Clear the metadatas array
- Returns:
- void
Definition at line 532 of file File.php.
_delMetadatas |
( |
$ |
id ) |
[protected] |
Drop a metadata record
- Parameters:
-
- Returns:
- boolean True if no problem
Definition at line 518 of file File.php.
_expireTime |
( |
$ |
lifetime ) |
[protected] |
Compute & return the expire time
- Returns:
- int expire time (unix timestamp)
Definition at line 816 of file File.php.
_file |
( |
$ |
id ) |
[protected] |
Make and return a file name (with path)
- Parameters:
-
- Returns:
- string File name (with path)
Definition at line 867 of file File.php.
_fileGetContents |
( |
$ |
file ) |
[protected] |
Return the file content of the given file
- Parameters:
-
string | $file | File complete path |
- Returns:
- string File content (or false if problem)
Definition at line 946 of file File.php.
_fileNameToId |
( |
$ |
fileName ) |
[protected] |
Transform a file name into cache id and return it
- Parameters:
-
- Returns:
- string Cache id
Definition at line 993 of file File.php.
_filePutContents |
( |
$ |
file, |
|
|
$ |
string |
|
) |
| [protected] |
Put the given string into the given file
- Parameters:
-
string | $file | File complete path |
string | $string | String to put in file |
- Returns:
- boolean true if no problem
Definition at line 969 of file File.php.
_getMetadatas |
( |
$ |
id ) |
[protected] |
Get a metadatas record
- Parameters:
-
- Returns:
- array|false Associative array of metadatas
Definition at line 474 of file File.php.
_hash |
( |
$ |
data, |
|
|
$ |
controlType |
|
) |
| [protected] |
Make a control key with the string containing datas
- Parameters:
-
string | $data | Data |
string | $controlType | Type of control 'md5', 'crc32' or 'strlen' |
- Exceptions:
-
- Returns:
- string Control key
Definition at line 832 of file File.php.
_idToFileName |
( |
$ |
id ) |
[protected] |
Transform a cache id into a file name and return it
- Parameters:
-
- Returns:
- string File name
Definition at line 854 of file File.php.
_isMetadatasFile |
( |
$ |
fileName ) |
[protected] |
Check if the given filename is a metadatas one
- Parameters:
-
- Returns:
- boolean True if it's a metadatas one
Definition at line 590 of file File.php.
_loadMetadatas |
( |
$ |
id ) |
[protected] |
Load metadatas from disk
- Parameters:
-
- Returns:
- array|false Metadatas associative array
Definition at line 543 of file File.php.
_metadatasFile |
( |
$ |
id ) |
[protected] |
Make and return a file name (with path) for metadatas
- Parameters:
-
- Returns:
- string Metadatas file name (with path)
Definition at line 577 of file File.php.
_path |
( |
$ |
id, |
|
|
$ |
parts = false |
|
) |
| [protected] |
Return the complete directory path of a filename (including hashedDirectoryStructure)
- Parameters:
-
string | $id | Cache id |
boolean | $parts | if true, returns array of directory parts instead of single string |
- Returns:
- string Complete directory path
Definition at line 881 of file File.php.
_recursiveMkdirAndChmod |
( |
$ |
id ) |
[protected] |
Make the directory strucuture for the given id
- Parameters:
-
- Returns:
- boolean true
Definition at line 906 of file File.php.
_remove |
( |
$ |
file ) |
[protected] |
Remove a file
If we can't remove the file (because of locks or any problem), we will touch the file to invalidate it
- Parameters:
-
string | $file | Complete file path |
- Returns:
- boolean True if ok
Definition at line 609 of file File.php.
_saveMetadatas |
( |
$ |
id, |
|
|
$ |
metadatas |
|
) |
| [protected] |
Save metadatas to disk
- Parameters:
-
string | $id | Cache id |
array | $metadatas | Associative array |
- Returns:
- boolean True if no problem
Definition at line 561 of file File.php.
_setMetadatas |
( |
$ |
id, |
|
|
$ |
metadatas, |
|
|
$ |
save = true |
|
) |
| [protected] |
Set a metadatas record
- Parameters:
-
string | $id | Cache id |
array | $metadatas | Associative array of metadatas |
boolean | $save | optional pass false to disable saving to file |
- Returns:
- boolean True if no problem
Definition at line 496 of file File.php.
_test |
( |
$ |
id, |
|
|
$ |
doNotTestCacheValidity |
|
) |
| [protected] |
Test if the given cache id is available (and still valid as a cache record)
- Parameters:
-
string | $id | Cache id |
boolean | $doNotTestCacheValidity | If set to true, the cache validity won't be tested |
- Returns:
- boolean|mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record
Definition at line 928 of file File.php.
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) 'matchingAnyTag' => remove cache entries matching any given tags ($tags can be an array of strings or a single string)
- Parameters:
-
string | $mode | clean mode |
| tags | array $tags array of tags |
- Returns:
- boolean true if no problem
Implements Zend_Cache_Backend_Interface.
Definition at line 284 of file File.php.
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)
- Returns:
- array associative of with capabilities
Implements Zend_Cache_Backend_ExtendedInterface.
Definition at line 440 of file File.php.
getIdsMatchingAnyTags |
( |
$ |
tags = array() ) |
|
Return an array of stored cache ids which match any given tags
In case of multiple tags, a logical AND is made between tags
- Parameters:
-
- Returns:
- array array of any matching cache ids (string)
Implements Zend_Cache_Backend_ExtendedInterface.
Definition at line 345 of file File.php.
getIdsMatchingTags |
( |
$ |
tags = array() ) |
|
Return an array of stored cache ids which match given tags
In case of multiple tags, a logical AND is made between tags
- Parameters:
-
- Returns:
- array array of matching cache ids (string)
Implements Zend_Cache_Backend_ExtendedInterface.
Definition at line 319 of file File.php.
getIdsNotMatchingTags |
( |
$ |
tags = array() ) |
|
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
- Parameters:
-
- Returns:
- array array of not matching cache ids (string)
Implements Zend_Cache_Backend_ExtendedInterface.
Definition at line 332 of file File.php.
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
- Parameters:
-
- Returns:
- array array of metadatas (false if the cache id is not found)
Implements Zend_Cache_Backend_ExtendedInterface.
Definition at line 381 of file File.php.
load |
( |
$ |
id, |
|
|
$ |
doNotTestCacheValidity = false |
|
) |
| |
Test if a cache is available for the given id and (if yes) return it (false else)
- Parameters:
-
string | $id | cache id |
boolean | $doNotTestCacheValidity | if set to true, the cache validity won't be tested |
- Returns:
- string|false cached datas
Implements Zend_Cache_Backend_Interface.
Definition at line 173 of file File.php.
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 | $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) |
- Returns:
- boolean true if no problem
Implements Zend_Cache_Backend_Interface.
Definition at line 219 of file File.php.
setCacheDir |
( |
$ |
value, |
|
|
$ |
trailingSeparator = true |
|
) |
| |
Set the cache_dir (particular case of setOption() method)
- Parameters:
-
string | $value | |
boolean | $trailingSeparator | If true, add a trailing separator is necessary |
- Exceptions:
-
- Returns:
- void
Definition at line 151 of file File.php.
Test if a cache is available or not (for the given id)
- Parameters:
-
- Returns:
- mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record
Implements Zend_Cache_Backend_Interface.
Definition at line 201 of file File.php.
touch |
( |
$ |
id, |
|
|
$ |
extraLifetime |
|
) |
| |
Field Documentation
Initial value: array(
'cache_dir' => null,
'file_locking' => true,
'read_control' => true,
'read_control_type' => 'crc32',
'hashed_directory_level' => 0,
'hashed_directory_umask' => 0700,
'file_name_prefix' => 'zend_cache',
'cache_file_umask' => 0600,
'metadatas_array_max_size' => 100
)
Reimplemented from Zend_Cache_Backend.
Definition at line 90 of file File.php.
The documentation for this class was generated from the following file:
- E:/E/GEAMP/www/openbiz/openbiz/others/Zend/Cache/Backend/File.php