# Redis Shared Database Analyzer PRO
Category | Severity | Time To Fix |
---|---|---|
✅ Reliability | Major | 2 minutes |
Class: Enlightn\EnlightnPro\Analyzers\Reliability\RedisSharedDatabaseAnalyzer
# Introduction
This analyzer detects whether your Redis cache database is shared with other services such as queues, sessions or broadcasting.
If your Redis cache database is shared with other "persistent" services, whenever you clear your cache using the cache:clear
Artisan command, it will also clear your queues, sessions or broadcasting messages.
# How To Fix
To fix this issue, first set your queue, session and broadcasting configuration to use a Redis connection that differs from your cache connection in their respective config files:
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => 'default',
'retry_after' => 90,
'block_for' => null,
],
Next, make sure your persistent connection does not share the same database with your cache connection in your config/database.php
file:
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
# Skip Condition
This analyzer is skipped if your application's default cache store is not redis
.