Framework: [5.1] Redis Session Manager 'Class cache does not exist'

Created on 29 Mar 2016  路  9Comments  路  Source: laravel/framework

When using redis as a session manager, \Illuminate\Session\SessionManager generates an error on line 158:
return new CacheBasedSessionHandler(clone $this->app['cache']->driver($driver), $minutes);

ReflectionException in Container.php line 741: Class cache does not exist in Container.php line 741 at ReflectionClass->__construct('cache') in Container.php line 741 at Container->build('cache', array()) in Container.php line 631 at Container->make('cache', array()) in Application.php line 674 at Application->make('cache') in Container.php line 1163 at Container->offsetGet('cache') in SessionManager.php line 158 at SessionManager->createCacheHandler('redis') in SessionManager.php line 130 at SessionManager->createRedisDriver() in Manager.php line 87 at Manager->createDriver('redis') in Manager.php line 63 at Manager->driver() in SessionServiceProvider.php line 48 at SessionServiceProvider->Illuminate\Session\{closure}(object(Application), array()) in Container.php line 738

Most helpful comment

move it to boot

All 9 comments

Where exactly is this code please?

Is this your code, or the framework?

It looks like something's trying to make the cache too early.

This code comes from \Illuminate\Session\SessionManager in the framework

Right, but when are you calling the session manager? It looks like the session manager is being instantiated earlier than the framework would have otherwise done it, thus the cache is trying to be instantiated too early.

I'm not calling it at all. I'm just trying to start my root page that loads a blade file. The framework is spinning through the services and starting the session manager on its own.

image

this is caused by your macro service provider code/

move it to boot

Was this page helpful?
0 / 5 - 0 ratings