38 'connection_string' =>
'mongodb://localhost:27017',
39 'mongo_options' => [],
41 'collection' =>
'cache',
49 if (!extension_loaded(
'mongo') || !version_compare(\Mongo::VERSION,
'1.2.11',
'>=')) {
51 "At least 1.2.11 version of 'mongo' extension is required for using MongoDb cache backend" 68 $connection = new \Mongo($this->_options[
'connection_string'], $this->_options[
'mongo_options']);
69 $database =
$connection->selectDB($this->_options[
'db']);
70 $this->
_collection = $database->selectCollection($this->_options[
'collection']);
111 return array_keys(iterator_to_array(
$result));
129 return array_keys(iterator_to_array(
$result));
147 return array_keys(iterator_to_array(
$result));
160 self::COMPARISON_MODE_MATCHING_TAG =>
'$and',
161 self::COMPARISON_MODE_NOT_MATCHING_TAG =>
'$nor',
162 self::COMPARISON_MODE_MATCHING_ANY_TAG =>
'$or',
164 if (!isset($operators[$comparisonMode])) {
167 $operator = $operators[$comparisonMode];
169 foreach ($tags as $tag) {
201 [
'expire',
'tags',
'mtime']
213 public function touch($cacheId, $extraLifetime)
216 $condition = [
'_id' => $this->
_quoteString($cacheId),
'expire' => [
'$gt' => $time]];
217 $update = [
'$set' => [
'mtime' => $time],
'$inc' => [
'expire' => (int)$extraLifetime]];
238 'automatic_cleaning' =>
true,
240 'expired_read' =>
true,
242 'infinite_lifetime' =>
true,
256 public function load($cacheId, $notTestCacheValidity =
false)
259 if (!$notTestCacheValidity) {
262 [
'expire' => [
'$gt' =>
time()]],
281 [
'expire' => self::EXPIRATION_TIME_INFINITE],
282 [
'expire' => [
'$gt' =>
time()]],
302 public function save(
$data, $cacheId, $tags = [], $specificLifetime =
false)
307 $tags = array_map([$this,
'_quoteString'], $tags);
310 'data' => new \MongoBinData($this->
_quoteString(
$data), \MongoBinData::BYTE_ARRAY),
324 public function remove($cacheId)
350 case \Zend_Cache::CLEANING_MODE_ALL:
354 case \Zend_Cache::CLEANING_MODE_OLD:
357 case \Zend_Cache::CLEANING_MODE_MATCHING_TAG:
358 case \Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
359 case \Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
const COMPARISON_MODE_MATCHING_TAG
__construct(array $options=[])
taxRateField find('.mselect-list') .on( 'click.mselect-edit'
clean($mode=\Zend_Cache::CLEANING_MODE_ALL, $tags=[])
load($cacheId, $notTestCacheValidity=false)
const EXPIRATION_TIME_INFINITE
save($data, $cacheId, $tags=[], $specificLifetime=false)
_getQueryMatchingTags(array $tags, $comparisonMode)
const CLEANING_MODE_NOT_MATCHING_TAG
if($exist=($block->getProductCollection() && $block->getProductCollection() ->getSize())) $mode
const COMPARISON_MODE_NOT_MATCHING_TAG
static throwException($msg, Exception $e=null)
const CLEANING_MODE_MATCHING_ANY_TAG
getIdsNotMatchingTags($tags=[])
getIdsMatchingTags($tags=[])
const CLEANING_MODE_MATCHING_TAG
const COMPARISON_MODE_MATCHING_ANY_TAG
getLifetime($specificLifetime)
touch($cacheId, $extraLifetime)
getIdsMatchingAnyTags($tags=[])