The cache prefix setting has the default value:
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache')
But when I cache some data (using Redis), the cache key has an unexpected format:
app_database_app_cache:some-data
The cache key is prefixed with the database prefix. I expected the cache key to just be:
app_cache:some-data
Is this the correct behavior, and is it possible to change it somewhere?
2
Answers
I somehow didn't notice the
REDIS_PREFIX
env var which prepends a prefix. The file caching of config.php also made it harder to debug.For those who still lost, Redis key is the combination of two variables in Laravel.
config/database.php
config/cache.php
If you see an unexpected prefix or suffix in your key, you’d better look at those two.