Properties

$options

$options : array

Options disponibles :

====> (string) stockage_chemin : Chemin vers le fichier contenant la base SQLite.

====> (int) defragmentation_auto :

  • Désactive / Régler le processus de défragmentation automatique
  • Le processus de défragmentation automatiques réduit la taille du fichier contenant la base de données quand un ajout ou une suppression de cache est réalisée : 0 => pas de défragmentation automatique 1 => défragmentation automatique systématique x (integer) > 1 => défragmentation automatique toutes les 1 fois (au hasard) sur x ajout ou suppression de cache

Type

array — options disponibles

$bdd

$bdd : mixed

DB ressource

Type

mixed

$structure_ok

$structure_ok : boolean

Boolean to store if the structure has benn checked or not

Type

boolean

$Cache

$Cache

Methods

__construct()

__construct(array $options, \Cache $cache) : void

Constructor

Parameters

array $options

Associative array of options

\Cache $cache

Throws

\Zend_cache_Exception

__destruct()

__destruct() : void

Destructor

setEmplacement()

setEmplacement( $emplacement)

Parameters

$emplacement

charger()

charger(string $id,  $ne_pas_tester_validiter_du_cache) : string|false

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

Parameters

string $id

Cache id

$ne_pas_tester_validiter_du_cache

Returns

string|false —

Cached datas

tester()

tester(string $id) : mixed|false

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

Parameters

string $id

Cache id

Returns

mixed|false —

(a cache is not available) or "last modified" timestamp (int) of the available cache record

sauver()

sauver( $donnees, string $id, array $tags,  $duree_vie_specifique) : boolean

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 $id

Cache id

array $tags

Array of strings, the cache record will be tagged by each string entry

$duree_vie_specifique

Throws

\Zend_Cache_Exception

Returns

boolean —

True if no problem

supprimer()

supprimer(string $id) : boolean

Remove a cache record

Parameters

string $id

Cache id

Returns

boolean —

True if no problem

nettoyer()

nettoyer(string $mode, array $tags) : boolean

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 $mode

Clean mode

array $tags

Array of tags

Returns

boolean —

True if no problem

getIds()

getIds() : array

Return an array of stored cache ids

Returns

array —

array of stored cache ids (string)

getTags()

getTags() : array

Return an array of stored tags

Returns

array —

array of stored tags (string)

getIdsAvecLesTags()

getIdsAvecLesTags(array $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

array $tags

array of tags

Returns

array —

array of matching cache ids (string)

getIdsSansLesTags()

getIdsSansLesTags(array $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

array $tags

array of tags

Returns

array —

array of not matching cache ids (string)

getIdsAvecUnTag()

getIdsAvecUnTag(array $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

array $tags

array of tags

Returns

array —

array of any matching cache ids (string)

getPourcentageRemplissage()

getPourcentageRemplissage() : int

Return the filling percentage of the backend storage

Throws

\Zend_Cache_Exception

Returns

int —

integer between 0 and 100

getMetadonnees()

getMetadonnees(string $id) : array

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

string $id

cache id

Returns

array —

array of metadatas (false if the cache id is not found)

ajouterSupplementDureeDeVie()

ajouterSupplementDureeDeVie(string $id,  $supplement_duree_de_vie) : boolean

Give (if possible) an extra lifetime to the given cache id

Parameters

string $id

cache id

$supplement_duree_de_vie

Returns

boolean —

true if ok

initialiserOptionsParConfig()

initialiserOptionsParConfig()

setOptions()

setOptions( $options)

Parameters

$options

getConnexion()

getConnexion() : resource

Return the connection resource

If we are not connected, the connection is made

Throws

\Zend_Cache_Exception

Returns

resource —

Connection resource

requeter()

requeter(string $requete) : mixed|false

Execute une requête SQL sans afficher de messages d'erreur.

Parameters

string $requete

requête SQL

Returns

mixed|false —

resultats de la requête

defragmenterAutomatiquement()

defragmenterAutomatiquement() : void

Deal with the automatic vacuum process

enregisterTag()

enregisterTag(string $id, string $tag) : boolean

Register a cache id with the given tag

Parameters

string $id

Cache id

string $tag

Tag

Returns

boolean —

True if no problem

creerStructure()

creerStructure() : false

Build the database structure

Returns

false

verifierBddStructureVersion()

verifierBddStructureVersion() : boolean

Check if the database structure is ok (with the good version)

Returns

boolean —

True if ok

nettoyerSqlite()

nettoyerSqlite(string $mode, array $tags) : boolean

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 $mode

Clean mode

array $tags

Array of tags

Returns

boolean —

True if no problem

verifierEtCreerStructureBdd()

verifierEtCreerStructureBdd() : boolean

Check if the database structure is ok (with the good version), if no : build it

Throws

\Zend_Cache_Exception

Returns

boolean —

True if ok