简体   繁体   English

Laravel-服务器无法设置缓存

[英]Laravel - Server can't set cache

I'm currently setting a lot of settings from my settings table, in my local server everything is fine, but the problem is in the online environment, I don't know if I need to configure anything, but it is not setting the cache, what can it be? 我目前正在settings表中设置很多设置,在本地服务器上一切正常,但是问题出在在线环境中,我不知道是否需要配置任何东西,但是它没有设置缓存,那会是什么?

class SettingsServiceProvider extends ServiceProvider
{
    public function boot(Factory $cache, SettingRepository $settings)
    {
        if(Schema::hasTable('settings')){
            $settings = $cache->remember('settings', 60, function() use ($settings)
            {
                return $settings->lists();
            });
            config()->set('settings', $settings);
        }
    }
    public function register()
    {
        $this->app->bind(
            \App\Repositories\SettingRepository::class
        );
    }
}

composer clear-cache && composer dump-autoload解决了这个问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM