I am trying to cache my results using redis
in Laravel
by doing this
$result = Cache::remember('orders_cache', 10, function () use ($orders) {
return $orders;
});
return $result;
When I go in my Redis-Cli and do KEYS *
, I don't see orders_cache
key there. I have set the cache_driver
to redis
in my .env
and I also ran the command php artisan config:cache
. I have also installed predis package using composer as well.
My Dev environment is:
Any help on this would be appreciated. TIA
Redis instance supports 16 logical databases and numbered from 0 to 15, by default by runnig redis-cli
you connect to database 0
. you can take advantage of the Redis INFO command to show databases that contain keys and also another more info like:
db0:keys=1,expires=0,avg_ttl=0
db1:keys=2,expires=2,avg_ttl=2462100
That in may case, I have 2 database. now you can change the database you’re using with the select
command after you connect. for example:
select 1
and it will return OK
if the switch is successful. now you can see your laravel keys.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With