Quantcast
Channel: Active questions tagged redis+session - Stack Overflow
Viewing all articles
Browse latest Browse all 309

Laravel session with Redis

$
0
0

I have set up Laravel with Redis as the session driver. I'm having a hard time understanding the difference between calling Session facade and Redis facade. If session is set up to use Redis, then Session::get('test') should return the same output as Redis::get('test'), right?

This is what I have tried with Tinker:

>>> Session::put('test',123);=> null>>> Session::get('test');=> 123// Why is this not 123?>>> Redis::get('test');=> null// Verify that Session is using Redis>>> Session::getDefaultDriver();=> redis

.env file:

REDIS_HOST=redisREDIS_PASSWORD=nullREDIS_PORT=6379SESSION_DRIVER=redisSESSION_CONNECTION=session

database.php

'redis'          => ['cluster' => false,'client' => 'predis','default' => ['host'     => env('DATA_REDIS_HOST', env('REDIS_HOST', '127.0.0.1')),'password' => env('REDIS_PASSWORD', null),'port'     => env('REDIS_PORT', 6379),'database' => 0,        ],'session' => ['host'     => env('DATA_REDIS_HOST', env('REDIS_HOST', '127.0.0.1')),'password' => env('REDIS_PASSWORD', null),'port'     => env('REDIS_PORT', 6379),'database' => 1,        ],    ],

Viewing all articles
Browse latest Browse all 309


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>