Setting up Cakephp & memcache

September 15, 2014 6.3k views

Hi guys,

I am trying to setup memcache in Cakephp (2.5.3) on ubuntu 14.

Here's what I have done :

1) Setup memcache (based on this ). All is working fine (info.php, grep, service is running, etc).

2) Update cakephp 'bootstrap.php'. Change

// Cache::config('default', array('engine' => 'File'));
Cache::config('default', array('engine' => 'Memcache'));

When i load my cakephp page, this error appears :

Cache engine default is not properly configured.
3 Answers

Changed in version 2.5: The Memcached engine was added. And the Memcache engine was deprecated.

Try using the "Memcached" engine instead:

Cache::config('default', array('engine' => 'Memcached'));

I tried to change it to 'memcached' in bootstrap.php

Cache::config('default', array('engine' => 'Memcached'));

Error :

Cache engine default is not available.

After that, I update core.php with this configuration below but got a fatal error.

Cache::config('default', array(
        'engine' => 'Memcached', //[required]
        'duration' => 3600, //[optional]
        'probability' => 100, //[optional]
        'prefix' => Inflector::slug(APP_DIR) . '_', //[optional]  prefix every cache file with this string
        'servers' => array(
            '' // localhost, default port 11211

        ), //[optional]
        'persistent' => 'my_connection', // [optional] The name of the persistent connection.
        'compress' => false, // [optional] compress data in Memcached (slower, but uses less memory)

Error :

Fatal error: Uncaught exception 'CacheException' with message 'Cache engine default is not available.' in /var/www/html/my/lib/Cake/Cache/Cache.php:173 Stack trace: #0 /var/www/html/my/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('default') #1 /var/www/html/my/app/Config/core.php(410): Cache::config('default', Array) #2 /var/www/html/my/lib/Cake/Core/Configure.php(72): include('/var/www/html/m...') #3 /var/www/html/my/lib/Cake/bootstrap.php(175): Configure::bootstrap(true) #4 /var/www/html/my/app/webroot/index.php(90): include('/var/www/html/m...') #5 {main} thrown in /var/www/html/my/lib/Cake/Cache/Cache.php on line 173

Are there any settings in core.php ?

I have the most trending multiplayer cards game to play if you are addicted to play card game then from our website you will play hearts online free game on your desktop browser without any interruption and time limit.

Have another answer? Share your knowledge.