예제 #1
0
 /**
  * Cleans entries from journal.
  *
  * @param  array  $conds
  *
  * @return array of removed items or NULL when performing a full cleanup
  */
 public function clean(array $conds)
 {
     if (!empty($conds[Cache::ALL])) {
         $all = $this->client->keys(self::NS_NETTE . ':*');
         $this->client->multi();
         call_user_func_array([$this->client, 'del'], $all);
         $this->client->exec();
         return NULL;
     }
     $entries = [];
     if (!empty($conds[Cache::TAGS])) {
         foreach ((array) $conds[Cache::TAGS] as $tag) {
             $this->cleanEntry($found = $this->tagEntries($tag));
             $entries = array_merge($entries, $found);
         }
     }
     if (isset($conds[Cache::PRIORITY])) {
         $this->cleanEntry($found = $this->priorityEntries($conds[Cache::PRIORITY]));
         $entries = array_merge($entries, $found);
     }
     return array_unique($entries);
 }