Edit this page

Memcached Cache Storage

This cache adapter will store all of your data to Memcached. It's using PHP's native Memcached extension so nothing else has to be installed or configured in your project to use this cache storage.

If you're getting error that Memcached class does not exists, then make sure you have properly installed PHP extension for Memcached.


'memcached' => [
    'enabled' => true,
    'adapter_class' => '\Koldy\Cache\Adapter\Memcached',

    'options' => [
        'servers' => [ // used in addServers method: http://php.net/manual/en/memcached.addservers.php
            ['localhost', 11211]
        'persistent_id' => 'koldy',
        'adapter_options' => []



This is the exact same array that you would pass to addServer() method. Read more here.

Persistent ID

This value is passed to Memcached constructor. You can find out more about it here.

Adapter Options

This array will be passed to Memcached setOptions() method. Read more here.

The only option that framework will put here by default is Memcached::OPT_LIBKETAMA_COMPATIBLE => true because it'll increase compatibility with other systems that may access the same Memcached server. Read more about this here.


This is not mandatory option, but if it's set, then all keys will be prefixed with this.

← Back To Cache