I'm using Laravel Cache facade, and the CACHE_DRIVER=redis
. All data is saved in Redis successfully, but when I use redis-cli
and run keys*
there are not keys!
When using the command flushall in redis-cli
it loads the data again from the database, so that means the keys are already stored in Redis.
Redis has 16 databases indexed 0 - 15. The default database index is 0
, so when you run redis commands without specifying the database index, you're only running commands against database index 0
. However, as of Laravel 5.7, Laravel stores all the cache data in database index 1
.
In order to see the keys in your cache database, you need to query database 1
. You can either use the -n
switch on the command line to specify the database index, or use the select
command at the redis prompt to change the active database.
redis-cli -n 1 keys "*"
or
#> redis-cli
127.0.0.1:6379> select 1
127.0.0.1:6379[1]> 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