用memcache照亮数据库

时间:2013-11-14 17:44:00

标签: php memcached laravel-4

我正在尝试做的是使用memcached与larval以外的幼虫数据库库这就是我所拥有但我无法让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();

1 个答案:

答案 0 :(得分:0)

         $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);