DependencyInjection/LswMemcacheExtension.php
private function enableSessionSupport($config, ContainerBuilder $container)
    {
        // make sure the pool is specified and it exists
        $pool = $config['session']['pool'];
        if (null === $pool) {
            return;
        }
        if (!isset($config['pools']) || !isset($config['pools'][$pool])) {
            throw new \LogicException(sprintf('The pool "%s" does not exist! Cannot enable the session support!', $pool));
        }
        // calculate options
        $sessionOptions = $container->getParameter('session.storage.options');
        $options = array();
        if (isset($config['session']['ttl'])) {
            $options['expiretime'] = $config['session']['ttl'];
        } elseif (isset($sessionOptions['cookie_lifetime'])) {
            $options['expiretime'] = $sessionOptions['cookie_lifetime'];
        }
        $options['prefix'] = $config['session']['prefix'];
        $options['locking'] = $config['session']['locking'];
        $options['spin_lock_wait'] = $config['session']['spin_lock_wait'];
        $options['lock_max_wait'] = $config['session']['lock_max_wait'];
        // set the auto_load parameter
        $container->setParameter('memcache.session_handler.auto_load', $config['session']['auto_load']);
        // load the session handler
        $definition = new Definition($container->getParameter('memcache.session_handler.class'));
        $container->setDefinition('memcache.session_handler', $definition);
        $definition
            ->addArgument(new Reference(sprintf('memcache.%s', $pool)))
            ->addArgument($options);
       	$this->addClassesToCompile(array($definition->getClass()));
    }
private function enableSessionSupport($config, ContainerBuilder $container)
    {
        // make sure the pool is specified and it exists
        $pool = $config['session']['pool'];
        if (null === $pool) {
            return;
        }
        if (!isset($config['pools']) || !isset($config['pools'][$pool])) {
            throw new \LogicException(sprintf('The pool "%s" does not exist! Cannot enable the session support!', $pool));
        }
        // calculate options
        $sessionOptions = $container->getParameter('session.storage.options');
        $options = array();
        if (isset($config['session']['ttl'])) {
            $options['expiretime'] = $config['session']['ttl'];
        } elseif (isset($sessionOptions['cookie_lifetime'])) {
            $options['expiretime'] = $sessionOptions['cookie_lifetime'];
        }
        $options['prefix'] = $config['session']['prefix'];
        $options['locking'] = $config['session']['locking'];
        $options['spin_lock_wait'] = $config['session']['spin_lock_wait'];
        $options['lock_max_wait'] = $config['session']['lock_max_wait'];
        // set the auto_load parameter
        $container->setParameter('memcache.session_handler.auto_load', $config['session']['auto_load']);
        // load the session handler
        $definition = new Definition($container->getParameter('memcache.session_handler.class'));
        $container->setDefinition('memcache.session_handler', $definition);
        $definition
            ->addArgument(new Reference(sprintf('memcache.%s', $pool)))
            ->addArgument($options);
       	$this->addClassesToCompile(array($definition->getClass()));
    }
private function enableSessionSupport ( $ config , ContainerBuilder $ container ) { // make sure the pool is specified and it exists $ pool = $ config [ 'session' ] [ 'pool' ] ; if ( null === $ pool ) { return ; } if ( ! isset ( $ config [ 'pools' ] ) || ! isset ( $ config [ 'pools' ] [ $ pool ] ) ) { throw new \ LogicException ( sprintf ( 'The pool "%s" does not exist! Cannot enable the session support!' , $ pool ) ) ; } // calculate options $ sessionOptions = $ container -> getParameter ( 'session.storage.options' ) ; $ options = array ( ) ; if ( isset ( $ config [ 'session' ] [ 'ttl' ] ) ) { $ options [ 'expiretime' ] = $ config [ 'session' ] [ 'ttl' ] ; } elseif ( isset ( $ sessionOptions [ 'cookie_lifetime' ] ) ) { $ options [ 'expiretime' ] = $ sessionOptions [ 'cookie_lifetime' ] ; } $ options [ 'prefix' ] = $ config [ 'session' ] [ 'prefix' ] ; $ options [ 'locking' ] = $ config [ 'session' ] [ 'locking' ] ; $ options [ 'spin_lock_wait' ] = $ config [ 'session' ] [ 'spin_lock_wait' ] ; $ options [ 'lock_max_wait' ] = $ config [ 'session' ] [ 'lock_max_wait' ] ; // set the auto_load parameter $ container -> setParameter ( 'memcache.session_handler.auto_load' , $ config [ 'session' ] [ 'auto_load' ] ) ; // load the session handler $ definition = new Definition ( $ container -> getParameter ( 'memcache.session_handler.class' ) ) ; $ container -> setDefinition ( 'memcache.session_handler' , $ definition ) ; $ definition -> addArgument ( new Reference ( sprintf ( 'memcache.%s' , $ pool ) ) ) -> addArgument ( $ options ) ; $ this -> addClassesToCompile ( array ( $ definition -> getClass ( ) ) ) ; }
Enables session support using Memcache based on the configuration

@param string           $config    Configuration for bundle
@param ContainerBuilder $container Service container

@return void
Enables session support using Memcache based on the configuration