The Laravel docs specify that you can enable memcached as a session handler in app/config/session.php; however, it does not specify where memcached itself is configured (such as the servers to use).
I see that you can configure memcached in app/config/cache.php, but I don't know if that's used just for the Cache driver or for the session handler as well.
Yes, the config in app/config/cache.php for your cache drivers is used for session driver as well.
Take a look at vendor/laravel/framework/src/Illuminate/Session/SessionManager.php. The method that creates an instance of the Memcached session driver is this one
/**
 * Create an instance of the Memcached session driver.
 *
 * @return \Illuminate\Session\Store
 */
protected function createMemcachedDriver()
{
    return $this->createCacheBased('memcached');
}
That method is calling this other method in the same file
/**
 * Create an instance of a cache driven driver.
 *
 * @param  string  $driver
 * @return \Illuminate\Session\Store
 */
protected function createCacheBased($driver)
{
    return $this->buildSession($this->createCacheHandler($driver)); //$driver = 'memcached'
}
Which is calling this other method in the same file
/**
 * Create the cache based session handler instance.
 *
 * @param  string  $driver
 * @return \Illuminate\Session\CacheBasedSessionHandler
 */
protected function createCacheHandler($driver)
{
    $minutes = $this->app['config']['session.lifetime'];
    return new CacheBasedSessionHandler($this->app['cache']->driver($driver), $minutes);
}
There you can see: this->app['cache']->driver($driver) which is actually getting your cache driver from the IoC container
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With