PHP Class Pimcore\Cache\Backend\Mongodb

Inheritance: extends Zend_Cache_Backend, implements Zend_Cache_Backend_ExtendedInterface
Afficher le fichier Open project: pimcore/pimcore

Protected Properties

Свойство Type Description
$_collection MongoCollection
$_conn Mongo
$_db MongoDB
$_options =====> (array) servers : an array of mongodb server ; each mongodb server is described by an associative array : 'host' => (string) : the name of the mongodb server 'port' => (int) : the port of the mongodb server 'collection' => (string) : name of the collection to use 'dbname' => (string) : name of the database to use

Méthodes publiques

Méthode Description
___expire ( string $id ) : void Expires a record (mostly used for testing purposes)
__construct ( $options ) : void
clean ( string $mode = Zend_Cache::CLEANING_MODE_ALL, array $tags = [] ) : boolean Clean some cache records (protected method used for recursive stuff)
drop ( )
get ( integer $id ) : array | false
getCapabilities ( ) : array Return an associative array of capabilities (booleans) of the backend
getFillingPercentage ( ) : integer No way to find the remaining space right now. So return 1.
getIds ( ) : array Return an array of stored cache ids
getIdsMatchingAnyTags ( array $tags = [] ) : array Return an array of stored cache ids which match any given tags
getIdsMatchingTags ( array $tags = [] ) : array Return an array of stored cache ids which match given tags
getIdsNotMatchingTags ( array $tags = [] ) : array Return an array of stored cache ids which don't match given tags
getMetadatas ( string $id ) : array Return an array of metadatas for the given cache id
getTags ( ) : array Return an array of stored tags
isAutomaticCleaningAvailable ( ) : boolean Return true if the automatic cleaning is available for the backend
load ( string $id, boolean $doNotTestCacheValidity = false ) : string | false Test if a cache is available for the given id and (if yes) return it (false else)
remove ( string $id ) : boolean Remove a cache record
save ( string $data, string $id, array $tags = [], integer $specificLifetime = false ) : boolean Save some string datas into a cache record
set ( integer $id, array $data, integer $lifetime, mixed $tags ) : boolean
setDirectives ( array $directives ) Set the frontend directives
test ( string $id ) : mixed | false Test if a cache is available or not (for the given id)
touch ( string $id, integer $extraLifetime ) : boolean Give (if possible) an extra lifetime to the given cache id

Method Details

___expire() public méthode

Expires a record (mostly used for testing purposes)
public ___expire ( string $id ) : void
$id string
Résultat void

__construct() public méthode

public __construct ( $options ) : void
Résultat void

clean() public méthode

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)
public clean ( string $mode = Zend_Cache::CLEANING_MODE_ALL, array $tags = [] ) : boolean
$mode string Clean mode
$tags array Array of tags
Résultat boolean True if no problem

drop() public méthode

public drop ( )

get() public méthode

public get ( integer $id ) : array | false
$id integer
Résultat array | false

getCapabilities() public méthode

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)
public getCapabilities ( ) : array
Résultat array associative of with capabilities

getFillingPercentage() public méthode

No way to find the remaining space right now. So return 1.
public getFillingPercentage ( ) : integer
Résultat integer integer between 0 and 100

getIds() public méthode

Return an array of stored cache ids
public getIds ( ) : array
Résultat array array of stored cache ids (string)

getIdsMatchingAnyTags() public méthode

In case of multiple tags, a logical AND is made between tags
public getIdsMatchingAnyTags ( array $tags = [] ) : array
$tags array array of tags
Résultat array array of any matching cache ids (string)

getIdsMatchingTags() public méthode

In case of multiple tags, a logical AND is made between tags
public getIdsMatchingTags ( array $tags = [] ) : array
$tags array array of tags
Résultat array array of matching cache ids (string)

getIdsNotMatchingTags() public méthode

In case of multiple tags, a logical OR is made between tags
public getIdsNotMatchingTags ( array $tags = [] ) : array
$tags array array of tags
Résultat array array of not matching cache ids (string)

getMetadatas() public méthode

The array must include these keys : - expire : the expire timestamp - tags : a string array of tags - mtime : timestamp of last modification time
public getMetadatas ( string $id ) : array
$id string cache id
Résultat array array of metadatas (false if the cache id is not found)

getTags() public méthode

Return an array of stored tags
public getTags ( ) : array
Résultat array array of stored tags (string)

isAutomaticCleaningAvailable() public méthode

Return true if the automatic cleaning is available for the backend

load() public méthode

Test if a cache is available for the given id and (if yes) return it (false else)
public load ( string $id, boolean $doNotTestCacheValidity = false ) : string | false
$id string Cache id
$doNotTestCacheValidity boolean If set to true, the cache validity won't be tested
Résultat string | false cached datas

remove() public méthode

Remove a cache record
public remove ( string $id ) : boolean
$id string Cache id
Résultat boolean True if no problem

save() public méthode

Note : $data is always "string" (serialization is done by the core not by the backend)
public save ( string $data, string $id, array $tags = [], integer $specificLifetime = false ) : boolean
$data string Datas to cache
$id string Cache id
$tags array Array of strings, the cache record will be tagged by each string entry
$specificLifetime integer If != false, set a specific lifetime for this cache record (null => infinite lifetime)
Résultat boolean True if no problem

set() public méthode

public set ( integer $id, array $data, integer $lifetime, mixed $tags ) : boolean
$id integer
$data array
$lifetime integer
$tags mixed
Résultat boolean

setDirectives() public méthode

Set the frontend directives
public setDirectives ( array $directives )
$directives array Assoc of directives

test() public méthode

Test if a cache is available or not (for the given id)
public test ( string $id ) : mixed | false
$id string Cache id
Résultat mixed | false (a cache is not available) or "last modified" timestamp (int) of the available cache record

touch() public méthode

Give (if possible) an extra lifetime to the given cache id
public touch ( string $id, integer $extraLifetime ) : boolean
$id string cache id
$extraLifetime integer
Résultat boolean true if ok

Property Details

$_collection protected_oe property

protected MongoCollection $_collection
Résultat MongoCollection

$_conn protected_oe property

protected Mongo $_conn
Résultat Mongo

$_db protected_oe property

protected MongoDB $_db
Résultat MongoDB

$_options protected_oe property

=====> (array) servers : an array of mongodb server ; each mongodb server is described by an associative array : 'host' => (string) : the name of the mongodb server 'port' => (int) : the port of the mongodb server 'collection' => (string) : name of the collection to use 'dbname' => (string) : name of the database to use
protected $_options