Methods summary
public
|
#
__construct( array $options = array(), Cache $cache )
Constructor
Parameters
- $options
array $options associative array of options
- $cache
Throws
Zend_Cache_Exception
|
public
|
|
public
string|false
|
#
charger( string $id, boolean $ne_pas_tester_validiter_du_cache = false )
Test if a cache is available for the given id and (if yes) return it (false
else)
Test if a cache is available for the given id and (if yes) return it (false
else)
Parameters
- $id
string $id cache id
- $ne_pas_tester_validiter_du_cache
boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
Returns
string|false cached datas
|
public
mixed
|
#
tester( string $id )
Teste si un enregistrement en cache est disponible ou pas (pour l'id passé
en paramètre).
Teste si un enregistrement en cache est disponible ou pas (pour l'id passé
en paramètre).
Parameters
- $id
string $id identifiant de cache.
Returns
mixed false (le cache n'est pas disponible) ou timestamp (int) "de dernière
modification" de l'enregistrement en cache
|
public
boolean
|
#
sauver( string $donnees, string $id, array $tags = array(), integer $duree_vie_specifique = false )
Save some string datas into a cache record
Save some string datas into a cache record
Note : $data is always "string" (serialization is done by the core not by the
backend)
Parameters
- $donnees
string $data Datas to cache
- $id
string $id Cache id
- $tags
array $tags Array of strings, the cache record will be tagged by each string entry
- $duree_vie_specifique
integer $specificLifetime If != false, set a specific lifetime for this cache record
(null => infinite lifetime)
Returns
boolean true if no problem
|
public
boolean
|
#
supprimer( string $id )
Remove a cache record
Parameters
Returns
boolean true if no problem
|
public
boolean
|
#
nettoyer( string $mode = Cache::NETTOYAGE_MODE_TOUS , tags $tags = array() )
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
- $mode
string $mode clean mode
- $tags
tags array $tags array of tags
Returns
boolean true if no problem
|
public
array
|
#
getIds( )
Return an array of stored cache ids
Return an array of stored cache ids
Returns
array array of stored cache ids (string)
|
public
array
|
#
getTags( )
Return an array of stored tags
Return an array of stored tags
Returns
array array of stored tags (string)
|
public
array
|
#
getIdsAvecLesTags( array $tags = array() )
Return an array of stored cache ids which match given tags
Return an array of stored cache ids which match given tags
In case of multiple tags, a logical AND is made between tags
Parameters
- $tags
array $tags array of tags
Returns
array array of matching cache ids (string)
|
public
array
|
#
getIdsSansLesTags( array $tags = array() )
Return an array of stored cache ids which don't match given tags
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
- $tags
array $tags array of tags
Returns
array array of not matching cache ids (string)
|
public
array
|
#
getIdsAvecUnTag( array $tags = array() )
Return an array of stored cache ids which match any given tags
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
- $tags
array $tags array of tags
Returns
array array of any matching cache ids (string)
|
public
integer
|
#
getPourcentageRemplissage( )
Return the filling percentage of the backend storage
Return the filling percentage of the backend storage
Returns
integer integer between 0 and 100
Throws
Zend_Cache_Exception
|
public
array
|
#
getMetadonnees( string $id )
Return an array of metadatas for the given cache id
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)
|
public
boolean
|
#
ajouterSupplementDureeDeVie( string $id, integer $supplement_duree_de_vie )
Give (if possible) an extra lifetime to the given cache id
Give (if possible) an extra lifetime to the given cache id
Parameters
- $id
string $id cache id
- $supplement_duree_de_vie
integer $extraLifetime
Returns
boolean true if ok
|
protected
array|false
|
#
getMetadonneesFichier( string $id )
Get a metadatas record
Parameters
Returns
array|false Associative array of metadatas
|
protected
boolean
|
#
setMetadonnees( string $id, array $metadonnees, boolean $sauvegarde = true )
Set a metadatas record
Parameters
- $id
string $id Cache id
- $metadonnees
array $metadatas Associative array of metadatas
- $sauvegarde
boolean $save optional pass false to disable saving to file
Returns
boolean True if no problem
|
protected
boolean
|
|
protected
|
|
protected
array|false
|
#
chargerMetadonnees( string $id )
Load metadatas from disk
Parameters
Returns
array|false Metadatas associative array
|
protected
boolean
|
#
sauverMetadonnees( string $id, array $metadonnees )
Save metadatas to disk
Parameters
- $id
string $id Cache id
- $metadonnees
array $metadatas Associative array
Returns
boolean True if no problem
|
protected
string
|
#
getNomFichierMeta( string $id )
Make and return a file name (with path) for metadatas
Make and return a file name (with path) for metadatas
Parameters
Returns
string Metadatas file name (with path)
|
protected
boolean
|
#
etreFichierMeta( string $fichier_nom )
Check if the given filename is a metadatas one
Check if the given filename is a metadatas one
Parameters
- $fichier_nom
string $fileName File name
Returns
boolean True if it's a metadatas one
|
protected
boolean
|
#
supprimerFichier( string $fichier )
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
- $fichier
string $file Complete file path
Returns
boolean True if ok
|
protected
boolean
|
#
nettoyerFichiers( string $dossier, string $mode = Cache::NETTOYAGE_MODE_TOUS , array $tags = array() )
Clean some cache records (protected method used for recursive stuff)
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
- $dossier
string $dir Directory to clean
- $mode
string $mode Clean mode
- $tags
array $tags Array of tags
Returns
boolean True if no problem
Throws
Zend_Cache_Exception
|
protected
|
|
protected
string
|
#
genererCleSecu( string $donnees, string $type_de_controle )
Make a control key with the string containing datas
Make a control key with the string containing datas
Parameters
- $donnees
string $data Data
- $type_de_controle
string $controlType Type of control 'md5', 'crc32' or 'strlen'
Returns
string Control key
Throws
Zend_Cache_Exception
|
protected
string
|
#
transformaterIdEnNomFichier( string $id )
Transform a cache id into a file name and return it
Transform a cache id into a file name and return it
Parameters
Returns
string File name
|
protected
string
|
#
getFichierNom( string $id )
Make and return a file name (with path)
Make and return a file name (with path)
Parameters
Returns
string File name (with path)
|
protected
string
|
#
getChemin( string $id, boolean $decoupage = false )
Return the complete directory path of a filename (including
hashedDirectoryStructure)
Return the complete directory path of a filename (including
hashedDirectoryStructure)
Parameters
- $id
string $id Cache id
- $decoupage
boolean $decoupage if true, returns array of directory parts instead of single string
Returns
string Complete directory path
|
protected
boolean
|
#
lancerMkdirEtChmodRecursif( string $id )
Make the directory strucuture for the given id
Make the directory strucuture for the given id
Parameters
Returns
boolean true
|
protected
boolean|mixed
|
#
testerExistenceCache( string $id, boolean $ne_pas_tester_validiter_du_cache )
Test if the given cache id is available (and still valid as a cache
record)
Test if the given cache id is available (and still valid as a cache
record)
Parameters
- $id
string $id Cache id
- $ne_pas_tester_validiter_du_cache
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
|
protected
string
|
#
getContenuFichier( string $fichier )
Return the file content of the given file
Return the file content of the given file
Parameters
- $fichier
string $file File complete path
Returns
string File content (or false if problem)
|
protected
boolean
|
#
setContenuFichier( string $fichier, string $chaine )
Put the given string into the given file
Put the given string into the given file
Parameters
- $fichier
string $file File complete path
- $chaine
string $string String to put in file
Returns
boolean true if no problem
|
protected
string
|
#
transformerNomFichierEnId( string $nom_de_fichier )
Transform a file name into cache id and return it
Transform a file name into cache id and return it
Parameters
- $nom_de_fichier
string $fileName File name
Returns
string Cache id
|