diff --git a/app/Jobs/Searcher.php b/app/Jobs/Searcher.php index 921370b021d961d445cfc48343d8771098149660..94ed1def48f0b5a81ab89dbdbedebbda5b732747 100644 --- a/app/Jobs/Searcher.php +++ b/app/Jobs/Searcher.php @@ -151,6 +151,8 @@ class Searcher implements ShouldQueue private function storeResult($result, $poptime, $hashValue){ Redis::hset('search.' . $hashValue, $this->name, $result); + // After 60 seconds the results should be read by the MetaGer Process and stored in the Cache instead + Redis::expire('search.' . $hashValue, 60); $this->lastTime = microtime(true); } diff --git a/app/Models/Searchengine.php b/app/Models/Searchengine.php index 184a3d326f9da03d832a48fe1d1111c36862ba78..51b6d2d005fa16f4bdaf3a8fefa0fbe67cfceb37 100644 --- a/app/Models/Searchengine.php +++ b/app/Models/Searchengine.php @@ -236,6 +236,7 @@ abstract class Searchengine $body = Cache::get($this->hash); } elseif (Redis::hexists('search.' . $this->resultHash, $this->name)) { $body = Redis::hget('search.' . $this->resultHash, $this->name); + Redis::hdel('search.' . $this->resultHash, $this->name); if ($this->canCache && $this->cacheDuration > 0) { Cache::put($this->hash, $body, $this->cacheDuration); } @@ -244,7 +245,6 @@ abstract class Searchengine $this->loadResults($body); $this->getNext($metager, $body); $this->loaded = true; - Redis::hdel('search.' . $this->hash, $this->name); return true; } else { return false;