The redis model config file is ignored
kornatzky opened this issue · 5 comments
With this config/redis-model.php
<?php
use Illuminate\Support\Str;
return [
'redis_model_options' => [
'database_default' => 'redis_model_default',
'prefix' => env('REDIS_MODEL_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_redis_model_'),
],
'commands' => [
'generate_path' => app_path('RedisModels'),
'rootNamespace' => 'App\\RedisModels',
],
'database' => [
'redis_model_default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', 'redis_model'),
],
],
];
and config/datbase.php containing,
'redis_model' => [
'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', '2'),
],
with REDIS_DB not defined in .env
It just stores models in db 0 of Redis.
However when I set for a model the connectionName it works.
Thank you, this error will be addressed in the upcoming version 0.6.
I overlooked it because I thought it would be of little concern to most people.
With this config/redis-model.php
<?php use Illuminate\Support\Str; return [ 'redis_model_options' => [ 'database_default' => 'redis_model_default', 'prefix' => env('REDIS_MODEL_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_redis_model_'), ], 'commands' => [ 'generate_path' => app_path('RedisModels'), 'rootNamespace' => 'App\\RedisModels', ], 'database' => [ 'redis_model_default' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_DB', 'redis_model'), ], ], ];
and config/datbase.php containing,
'redis_model' => [ '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', '2'), ],
with REDIS_DB not defined in .env
It just stores models in db 0 of Redis.
However when I set for a model the connectionName it works.
I may have overlooked this information when researching Redis: "In Redis, the default number of databases is 16 and they are numbered from 0 to 15 (you can customize this with your Redis instance)." (https://www.digitalocean.com/community/cheatsheets/how-to-manage-redis-databases-and-keys)
I will customize the default database of the redis-model package back to the value 0 so that at least no one will be confused anymore.
Thank you for asking such a great question and providing me with this useful information.
Have a great day!
Thanks for your attention.
Will be publishing your package with warm recommendations on Twitter, LinkedIn and Facebook. Take care
Will be publishing your package with warm recommendations on Twitter, LinkedIn and Facebook. Take care
Thank you for what you've done for me, it will be a great motivation for me.