Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
746f9938
Commit
746f9938
authored
Dec 05, 2019
by
Dominik Hebeler
Browse files
testing speed when redis is used to pass results
parent
cc3c7f8e
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/Console/Commands/WorkerSpawner.php
View file @
746f9938
...
...
@@ -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
)
{
...
...
app/MetaGer.php
View file @
746f9938
...
...
@@ -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
;
...
...
app/Models/Searchengine.php
View file @
746f9938
...
...
@@ -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);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment