Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function purge()
 {
     if ($this->collection instanceof \MongoDB\Collection) {
         $this->collection->deleteMany(['expiration' => ['$lte' => time()]]);
     } else {
         $this->collection->remove(['expiration' => ['$lte' => time()]], ['multiple' => true]);
     }
     return true;
 }
Пример #2
0
 /**
  * 
  * @param MongoCollection $collection
  */
 public function removeStatistics(MongoCollection $collection, $quiet = true)
 {
     try {
         $collection->remove(['account' => $this->getName()]);
     } catch (\Exception $ex) {
         if (!$quiet) {
             throw $ex;
         }
     }
 }