0

我正在尝试做的是在 larval 之外将 memcached 与 larvae 的数据库库一起使用,这就是我所拥有的,但我无法让 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();
4

1 回答 1

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);
于 2013-11-18T19:56:54.770 回答