Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not supported with redis-sentinel caching #141

Open
adamzwakk opened this issue Sep 19, 2018 · 2 comments
Open

Not supported with redis-sentinel caching #141

adamzwakk opened this issue Sep 19, 2018 · 2 comments

Comments

@adamzwakk
Copy link

Hey guys,

Trying to use https://github.com/monospice/laravel-redis-sentinel-drivers as my cache driver, and it won't let me load the driver at all if I have the Waavi/transaction service provider in my app.php config.

However, if I use the default laravel provider Illuminate\Translation\TranslationServiceProvider, it works fine and loads as expected. The developers over there suggested moving some of the logic into the boot() method so the cache driver can load properly monospice/laravel-redis-sentinel-drivers#17

Would you guys be able to help out with that and getting this different cache store supported?

@cyrossignol
Copy link

cyrossignol commented Sep 19, 2018

Looks like the problem occurs when registering the package's cache flushing Artisan command. The package's service provider ultimately resolves Laravel's cache service from the container during the provider registration phase before other providers finish initializing in the boot phase.

It seems like we want to bind the command so it resolves at run time:

if ($this->app->runningInConsole()) {
    $this->app->bind('command.translator:flush', function ($app) {
        return new CacheFlushCommand($app['translation.cache.repository'], $app['config']->get('translator.cache.enabled'));
    }

    $this->commands('command.translator:flush');
}

Alternatively, initialize the command in the provider's boot() method so applications can order dependencies as needed. We may want to follow the same pattern to register the file loader.

@adamzwakk
Copy link
Author

adamzwakk commented Sep 27, 2018

Just in case there was any doubt, disabling the caching for waavi/translation via TRANSLATION_CACHE_ENABLED=false and everything works great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants