I just attached the redis driver to Laravel cache.
Config:
'redis' => [
'driver' => 'redis',
'client' => 'predis',
'cluster' => false,
'default' => [
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
'read_write_timeout' => 60,
],
A basic one:
Cache::store('redis')->put('bar', 'baz', 10);
$val = Cache::get('bar');
Log::Debug($val);`
It returns an empty string. If I do:
Cache::put('bar', 'baz', 10);
$val = Cache::get('bar');
Log::Debug($val);
It returns 'baz'. But If I delete the put method, at the next attempt it will return again the empty string.
CLI monitor:
1505914946.350596 [0 127.0.0.1:39102] "SELECT" "0"
1505914946.351143 [0 127.0.0.1:39102] "SETEX" "laravel:bar" "600000" "s:3:\"baz\";"
Where I get it wrong?