使用内存缓存照亮数据库


Illuminate Database with memcache

我正在尝试做的是在幼虫之外将memcached与幼虫的数据库库一起使用,这是我拥有的,但我无法让memcache驱动程序工作

 $capsule = new Capsule();
        $k2Config = include(dirname(dirname(__FILE__)) . '/Config/k2.php');
        $unitConfig = array(
            'driver'   => 'sqlite',
            'database' => ':memory:',
            'prefix'   => ''
        );
        $capsule->addConnection($config);
        $capsule->addConnection($k2Config, 'k2');
        $capsule->addConnection($unitConfig, 'uTest');
        $capsule->setAsGlobal();

        // Setup cache
        $container = $capsule->getContainer();
        $container = new Container();
        $cacheManager = new CacheManager($container);
        $cacheManager->driver('memcached');
        $capsule->setCacheManager($cacheManager);
        return $capsule->connection();
         $container = $capsule->getContainer();
        $container['memcached.connector'] = new MemcachedConnector();
        $container['config']['cache.driver'] = 'memcached';
        $container['config']['cache.path'] = __DIR__ . '/cache';
        $container['config']['cache.connection'] = null;
        $container['config']['cache.table'] = 'cache';
        $container['config']['cache.memcached'] = array(array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100),);
        $container['config']['cache.prefix'] = 'INSP';
        $cacheManager = new CacheManager($container);
        $capsule->setCacheManager($cacheManager);