Commit 746f9938 authored by Dominik Hebeler's avatar Dominik Hebeler

testing speed when redis is used to pass results

parent cc3c7f8e
......@@ -2,7 +2,6 @@
namespace App\Console\Commands;
use Cache;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Redis;
use Log;
......@@ -97,7 +96,12 @@ class WorkerSpawner extends Command
} else {
$body = \curl_multi_getcontent($info["handle"]);
}
Cache::put($resulthash, $body, now()->addMinutes($cacheDuration));
Redis::pipeline(function ($pipe) use ($resulthash, $body) {
$pipe->set($resulthash, $body);
$pipe->expire($resulthash, 60);
});
#Cache::put($resulthash, $body, now()->addMinutes($cacheDuration));
\curl_multi_remove_handle($this->multicurl, $info["handle"]);
}
if (!$active && !$answerRead) {
......
......@@ -6,6 +6,7 @@ use App;
use Cache;
use Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redis;
use Jenssegers\Agent\Agent;
use LaravelLocalization;
use Log;
......@@ -805,7 +806,7 @@ class MetaGer
while (sizeof($enginesToWaitFor) > 0 || ($forceTimeout !== null && (microtime(true) - $timeStart) < $forceTimeout)) {
Log::info(sizeof($enginesToWaitFor) . " " . sizeof($answered) . " " . $enginesToWaitFor[0]->hash);
foreach ($enginesToWaitFor as $index => $engine) {
if (Cache::has($engine->hash)) {
if (Redis::get($engine->hash) !== null) {
$answered[] = $engine;
unset($enginesToWaitFor[$index]);
break;
......
......@@ -170,11 +170,11 @@ abstract class Searchengine
return true;
}
$body = null;
$body = Redis::get($this->hash);
if (Cache::has($this->hash)) {
$body = Cache::get($this->hash);
}
/*if (Cache::has($this->hash)) {
$body = Cache::get($this->hash);
}*/
/*
if ($this->canCache && $this->cacheDuration > 0 && Cache::has($this->hash)) {
$body = Cache::get($this->hash);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment