[Question] How to set prefix with your package ??
a-h-abid opened this issue · 2 comments
Hi, I'm trying to set prefix for my redis sentinel with your package. When I used single redis master, it uses the prefix from configuration file. But for sentinel, it is not working. Can you please help?
Using Lumen v6.3.5
My configuration:
'redis' => [
'driver' => env('REDIS_DRIVER', 'redis-sentinel'),
'client' => 'predis',
'cluster' => env('REDIS_CLUSTER', false),
'default' => [
'host' => env('REDIS_HOST'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DB', 0),
'read_write_timeout' => 60,
'prefix' => env('REDIS_PREFIX', ''),
],
],
Hi @a-h-abid,
The configuration that you show above does not apply to Sentinel connections. This package uses a separate configuration block so that developers can configure Redis and Sentinel connections separately if needed.
We can set a prefix in the options for a Sentinel connection like we can for standard Redis connections:
'redis-sentinel' => [
'default' => [
...
'options' => [
...
'prefix' => env('REDIS_PREFIX', 'example:'),
],
],
],
If you're using the environment-based configuration for Lumen, you'll need to create a configuration file (either database.php or redis-sentinel.php) for the above because this package doesn't consume the REDIS_PREFIX
environment variable automatically yet.
Thanks for the help. Mangaed to get it to work.