Quantcast
Channel: How to configure cakephp to use memcached - Stack Overflow
Viewing all articles
Browse latest Browse all 2

How to configure cakephp to use memcached

$
0
0

I'm trying to use an external cache engine, memcached, to power my CakePHP app.

I have an AWS EC2 instance running the app and also an AWS ElastiCache Cluster with one node using memcached. The memcache and memcached php modules are also installed and enabled.

The configuration in the app.php file is as follows:

'Cache' => [
         'default' => [
            'className' => 'File',
            'path' => CACHE,
        ],

        'elastic' => [
            'className' => 'Cake\Cache\Engine\MemcachedEngine',
            'compress' => false,
            'duration' => '+2 minutes',
            'groups' => [],
            'host' => 'yyy.euw1.cache.amazonaws.com:11211',
            'username' => null,
            'password' => null,
            'persistent' => false,
            'prefix' => 'cake_',
            'probability' => 100,
            'serialize' => 'php',
            'servers' => ['yyy.euw1.cache.amazonaws.com:11211'],
            'options' => [],
             'lock' => true
        ]

To select whether or not to query the database, this condition is used:

if (($car = Cache::read('car', 'elastic')) === false) {

    $car = $this->Cars->get();
    Cache::write('car', $car, 'elastic');

}

Unfortunately, after a long page load I get this error:

"elastic cache was unable to write to DebugKit\Cache\Engine\DebugEngine cache"

Does anyone knows the origin of this error? Can someone guide me through the configuration of memcached for cakephp, using an external cache engine?

Thank you upfront!


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images