예제 #1
0
 public function getItems()
 {
     $stash = Registry::getStash();
     $cache = $stash->getItem('nyaa/feed/series/' . str_replace('/', '~', $this->seriesHash) . '/' . $this->query);
     if ($cache->isMiss() || true) {
         $cache->lock();
         $nyaaCollector = Registry::getNyaaCollector();
         $mappedByHash = $nyaaCollector->collect($this->query);
         $torrents = [];
         if (isset($mappedByHash[$this->seriesHash])) {
             $torrents = $mappedByHash[$this->seriesHash]->getTorrents();
         }
         $cache->set($torrents, 864000);
     }
     return $cache->get();
 }
예제 #2
0
 public static function getById($id)
 {
     $db = Registry::getDatabase();
     $feed = $db->builder()->select()->from('feed')->where('id = :id', [':id' => $id])->queryRow();
     return Feed::createFromArray($feed);
 }