CakePHP Memcached CakePHP2.5.x

时间:2014-06-22 18:43:15

标签: cakephp memcached cakephp-2.5

我已升级到CakePHP 2.5.x系列,现在尝试实现替换Memcache的新Memcached引擎;但是我得到以下内容:

_ cake_core_ cache无法将'cake_dev_en-us'写入Memcached缓存...  未捕获的异常'CacheException',消息'不是Memcached的有效序列化引擎'

我已使用正确的值更新了bootstrap.php和core.php。 Memcached在我的Ubuntu 14.04服务器上使用localhost(127.0.0.1)上的端口11211正常工作。任何帮助将不胜感激

由于

1 个答案:

答案 0 :(得分:2)

这是因为在Config / core.php中,以下'序列化'如果缓存引擎设置为" Memcached",则参数将设置为false,但MemcachedEngine需要' serialize'被设置在' php',#igbinary'和' json'。您可以只注释掉"序列化"线,所以' php'将是默认值。

/**
 * Configure the cache used for general framework caching. Path information,
 * object listings, and translation cache files are stored with this configuration.
 */
Cache::config('_cake_core_', array(
    'engine' => $engine,
    'prefix' => $prefix . 'cake_core_',
    'path' => CACHE . 'persistent' . DS,
    'serialize' => ($engine === 'File'),
    'duration' => $duration
));

/**
 * Configure the cache for model and datasource caches. This cache configuration
 * is used to store schema descriptions, and table listings in connections.
 */
Cache::config('_cake_model_', array(
    'engine' => $engine,
    'prefix' => $prefix . 'cake_model_',
    'path' => CACHE . 'models' . DS,
    'serialize' => ($engine === 'File'),
    'duration' => $duration
));