soupmix/cache-memcached

This package is abandoned and no longer maintained. The author suggests using the soupmix/cache package instead.

Framework agnostic Memcached adapter for SimpleCache Interface.

0.3.3 2017-10-31 06:20 UTC

This package is auto-updated.

Last update: 2021-06-26 21:46:00 UTC


README

Build Status Scrutinizer Code Quality Codacy Badge Code Climate Latest Stable Version Total Downloads Latest Unstable Version License composer.lock Code Coverage

Installation

It's recommended that you use Composer to install Soupmix Cache Memcached Adaptor.

$ composer require soupmix/cache-memcached "~0.3"

Connection

require_once '/path/to/composer/vendor/autoload.php';

$config = [
    'bucket' => 'test',
    'hosts'   => ['127.0.0.1'],
;
$handler = new Memcached($config['bucket']);
$handler->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
$handler->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
if (!count($handler->getServerList())) {
    $hosts = [];
    foreach ($config['hosts'] as $host) {
        $hosts[] = [$host, 11211];
    }
    $handler->addServers($hosts);
}

$cache = new Soupmix\Cache\MemcachedCache($handler);

Soupmix Memcached Cache API

See Soupmix Cache API