diff --git a/app/Http/Controllers/MetaGerSearch.php b/app/Http/Controllers/MetaGerSearch.php index 114768abddab3e0f9e9a0e40e93df9c825e20ad6..4f0705026821d5ead6325773b499afb5cac2b88f 100644 --- a/app/Http/Controllers/MetaGerSearch.php +++ b/app/Http/Controllers/MetaGerSearch.php @@ -12,7 +12,7 @@ use View; class MetaGerSearch extends Controller { - public function search(Request $request, MetaGer $metager, $timing = false) + public function search(Request $request, MetaGer $metager, $timing = false, $nocache = false) { if ($request->filled("chrome-plugin")) { return redirect(LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/plugin")); @@ -123,20 +123,21 @@ class MetaGerSearch extends Controller $engine->markNew(); } } - - try { - Cache::put("loader_" . $metager->getSearchUid(), [ - "metager" => [ - "apiAuthorized" => $metager->isApiAuthorized(), - ], - "adgoal" => [ - "loaded" => $metager->isAdgoalLoaded(), - "adgoalHash" => $metager->getAdgoalHash(), - ], - "engines" => $metager->getEngines(), - ], 60 * 60); - } catch (\Exception $e) { - Log::error($e->getMessage()); + if($nocache){ + try { + Cache::put("loader_" . $metager->getSearchUid(), [ + "metager" => [ + "apiAuthorized" => $metager->isApiAuthorized(), + ], + "adgoal" => [ + "loaded" => $metager->isAdgoalLoaded(), + "adgoalHash" => $metager->getAdgoalHash(), + ], + "engines" => $metager->getEngines(), + ], 60 * 60); + } catch (\Exception $e) { + Log::error($e->getMessage()); + } } if (!empty($timings)) { $timings["Filled resultloader Cache"] = microtime(true) - $time; diff --git a/app/Http/Controllers/Stresstest.php b/app/Http/Controllers/Stresstest.php index 4d0977843cc65c1577714061f34b741b42cb1ffe..cf432279c760f07035ade3fd6d22b2b3b53e6abf 100644 --- a/app/Http/Controllers/Stresstest.php +++ b/app/Http/Controllers/Stresstest.php @@ -17,13 +17,17 @@ class Stresstest extends MetaGerSearch return redirect("admin/stress/search?eingabe=test"); } - public function search(Request $request, MetaGer $metager, $timing = false) + public function search(Request $request, MetaGer $metager, $timing = false, $nocache = false) { if(empty($request->input('eingabe'))) { return redirect("admin/stress/search?eingabe=test"); } $metager->setDummy(true); $metager->setAdgoalHash(true); - parent::search($request, $metager, $timing); + if(!empty($request->input('cache')) && $request->input('cache') === 'off') { + parent::search($request, $metager, $timing, true); + } else { + parent::search($request, $metager, $timing); + } } } \ No newline at end of file