src/Towel/BaseApp.php
public function getCache()
    {
        if (null === self::$cache) {
            if (!empty($this->appConfig['cache']['driver'])) {
                // Options definition.
                if (empty($this->appConfig['cache']['options'])) {
                    $options = array();
                } else {
                    $options = $this->appConfig['cache']['options'];
                }

                // Driver definition.
                if ('memcached' !== $this->appConfig['cache']['driver']) {
                    $className = $this->appConfig['cache']['driver'];
                } else {
                    $className = '\Towel\Cache\TowelMemcached';
                }

                // Driver instantiation
                $cacheDriver = new $className();
                $cacheDriver->setOptions($options);
            }

            self::$cache = new TowelCache($cacheDriver);
        }

        return self::$cache;
    }
public function getCache()
    {
        if (null === self::$cache) {
            if (!empty($this->appConfig['cache']['driver'])) {
                // Options definition.
                if (empty($this->appConfig['cache']['options'])) {
                    $options = array();
                } else {
                    $options = $this->appConfig['cache']['options'];
                }

                // Driver definition.
                if ('memcached' !== $this->appConfig['cache']['driver']) {
                    $className = $this->appConfig['cache']['driver'];
                } else {
                    $className = '\Towel\Cache\TowelMemcached';
                }

                // Driver instantiation
                $cacheDriver = new $className();
                $cacheDriver->setOptions($options);
            }

            self::$cache = new TowelCache($cacheDriver);
        }

        return self::$cache;
    }
public function getCache ( ) { if ( null === self :: $ cache ) { if ( ! empty ( $ this -> appConfig [ 'cache' ] [ 'driver' ] ) ) { // Options definition. if ( empty ( $ this -> appConfig [ 'cache' ] [ 'options' ] ) ) { $ options = array ( ) ; } else { $ options = $ this -> appConfig [ 'cache' ] [ 'options' ] ; } // Driver definition. if ( 'memcached' !== $ this -> appConfig [ 'cache' ] [ 'driver' ] ) { $ className = $ this -> appConfig [ 'cache' ] [ 'driver' ] ; } else { $ className = '\Towel\Cache\TowelMemcached' ; } // Driver instantiation $ cacheDriver = new $ className ( ) ; $ cacheDriver -> setOptions ( $ options ) ; } self :: $ cache = new TowelCache ( $ cacheDriver ) ; } return self :: $ cache ; }
Instantiate Cache driver
@return \Towel\Cache\CacheInterface
Instantiate Cache driver