Sandeep Kumar jain
Sandeep Kumar jain

Reputation: 39

Memcached setup with cakephp3

I am setting up memcache setup with cakephp3. I added below in config/app.php

'Cache' => [
   'default' => [
        'className' => 'Cake\Cache\Engine\MemcachedEngine',            
    ],
]

On the top of the controller I added use Cake\Cache\Cache; use Cake\Cache\CacheEngine; use Cake\Cache\CacheRegistry;

But when I used any function of memcache like Cache::write('variable','value'); etc It is giving me error " Error: Cache engine Cake\Cache\Engine\MemcachedEngine is not properly configured. "

The memcached is installed on server.. here is the output

/etc/php.d/memcache.ini,
memcache
memcache support => enabled
memcache.allow_failover => 1 => 1
memcache.chunk_size => 32768 => 32768
memcache.compress_threshold => 20000 => 20000
memcache.default_port => 11211 => 11211
memcache.hash_function => crc32 => crc32
memcache.hash_strategy => consistent => consistent
memcache.lock_timeout => 15 => 15
memcache.max_failover_attempts => 20 => 20
memcache.protocol => ascii => ascii
memcache.redundancy => 1 => 1
memcache.session_redundancy => 2 => 2

Please let me know what is the remaining in configuration. Thanks in advance.

Upvotes: 3

Views: 1619

Answers (1)

AD7six
AD7six

Reputation: 66227

Wrong extension

There are two php extensions related to memcache:

The CakePHP Memcached driver relies on memcacheD:

if (!extension_loaded('memcached')) {
    return false;
}

Which will result in that error message if it's missing:

if (!$instance->init($config)) {
    throw new RuntimeException(
        sprintf('Cache engine %s is not properly configured.', get_class($instance))
    );
}

Upvotes: 1

Related Questions