protected function KeyvalueMongodb::getHelper in MongoDB 8
Executes the get for getMultiple() and getAll().
Parameters
array|null $keys:
Return value
array
2 calls to KeyvalueMongodb::getHelper()
- KeyvalueMongodb::getAll in src/
KeyvalueMongodb.php - Returns all stored key/value pairs in the collection.
- KeyvalueMongodb::getMultiple in src/
KeyvalueMongodb.php - Returns the stored key/value pairs for a given set of keys.
File
- src/
KeyvalueMongodb.php, line 149
Class
- KeyvalueMongodb
- This class holds a MongoDB key-value backend.
Namespace
Drupal\mongodbCode
protected function getHelper($keys = NULL) {
$find = array();
if ($keys) {
$find['_id'] = array(
'$in' => $this
->strMap($keys),
);
}
$find['$or'] = array(
array(
'expire' => array(
'$gte' => new \MongoDate(),
),
),
array(
'expire' => array(
'$exists' => FALSE,
),
),
);
$result = $this
->collection()
->find($find);
$return = array();
foreach ($result as $row) {
$return[$row['_id']] = $row['scalar'] ? $row['value'] : unserialize($row['value']);
}
return $return;
}