\MongodbBackend
Notes: Use MongoDB 3.x
- Author: Andre Lohmann (lohmann.andre@gmail.com)
- Copyright: Copyright (c) 2005 Andre Lohmann (https://github.com/andrelohmann)
- License: http://framework.zend.com/license/new-bsd New BSD License
Synopsis
class MongodbBackend
extends Zend_Cache_Backend
implements
Zend_Cache_Backend_ExtendedInterface
{
- // constants
- const DEFAULT_HOST = '127.0.0.1';
- const DEFAULT_PORT = 27017;
- const DEFAULT_DBNAME = 'Db_Cache';
- const DEFAULT_COLLECTION = 'C_Cache';
- // members
- protected MongoDb|null $_database = NULL;
- protected MongoCollection|null $_collection = NULL;
- protected array $_options = ;
- // methods
- public void __construct()
- private string _getServerConnectionUrl()
- public void setDirectives()
- public string|false load()
- public mixed|false test()
- public boolean save()
- public boolean remove()
- public boolean clean()
- public boolean isAutomaticCleaningAvailable()
- public array getIds()
- public array getTags()
- public array getIdsMatchingTags()
- public array getIdsNotMatchingTags()
- public array getIdsMatchingAnyTags()
- public int getFillingPercentage()
- public array getMetadatas()
- public boolean touch()
- public array getCapabilities()
- private boolean _set()
- private array|bool _get()
Hierarchy
Extends
- Zend_Cache_Backend
Implements
- Zend_Cache_Backend_ExtendedInterface
Constants
Name | Value |
---|---|
DEFAULT_HOST | '127.0.0.1' |
DEFAULT_PORT | 27017 |
DEFAULT_DBNAME | 'Db_Cache' |
DEFAULT_COLLECTION | 'C_Cache' |
Members
protected
- $_collection
—
MongoCollection|null
MongoCollection - $_database — MongoDb|null
- $_options
—
array
Available options: 'host' => (string): the name of the MongoDB server 'port' => (int): the port of the MongoDB server 'user' => (string): username to connect as 'password' => (string): password to connect with 'dbname' => (string): name of the database to use 'collection' => (string): name of the collection to use
Methods
private
- _get() — Lookups a specific cache entry.
- _getServerConnectionUrl() — Assembles the URL that can be used to connect to the MongoDB server.
- _set() — Saves data to a the MongoDB collection.
public
- __construct() — Note that we use TTL Collections to have the Mongo deamon automatically clean expired entries.
- clean() — Clean some cache records
- getCapabilities() — Return an associative array of capabilities (booleans) of the backend
- getFillingPercentage() — Return the filling percentage of the backend storage
- getIds() — Return an array of stored cache ids
- getIdsMatchingAnyTags() — Return an array of stored cache ids which match any given tags
- getIdsMatchingTags() — Return an array of stored cache ids which match given tags
- getIdsNotMatchingTags() — Return an array of stored cache ids which don't match given tags
- getMetadatas() — Return an array of metadatas for the given cache id
- getTags() — Return an array of stored tags
- isAutomaticCleaningAvailable() — Return true if the automatic cleaning is available for the backend
- load() — Test if a cache is available for the given id and (if yes) return it (false else)
- remove() — Remove a cache record
- save() — Save some string datas into a cache record
- setDirectives() — Sets the frontend directives.
- test() — Test if a cache is available or not (for the given id)
- touch() — Give (if possible) an extra lifetime to the given cache id