/** * {@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; }
/** * * @param MongoCollection $collection */ public function removeStatistics(MongoCollection $collection, $quiet = true) { try { $collection->remove(['account' => $this->getName()]); } catch (\Exception $ex) { if (!$quiet) { throw $ex; } } }