Memcache coroutine client

Memcache coroutine client, implemented by swoole coroutine client
Github address: https://github.com/easy-swoole/memcache

Composer installation

composer require easyswoole/memcache

Use the client (requires a coroutine environment):

$config = new \EasySwoole\Memcache\Config([
    'host' => '127.0.0.1',
    'port' => 11211
]);
$client = new EasySwoole\Memcache\Memcache($config);

Example of use:

$config = new \EasySwoole\Memcache\Config([
    'host' => '127.0.0.1',
    'port' => 11211
]);
$client = new EasySwoole\Memcache\Memcache($config);
$client->set('a',1);
$client->get('a');

Instructions:

touchTouch (refresh validity period)

Touch($key, $expiration, $timeout = null)

Increment increment KEY

Increment($key, $offset = 1, $initialValue = 0, $expiration = 0, $timeout = null)

decrement decrement KEY

Decrement($key, $offset = 1, $initialValue = 0, $expiration = 0, $timeout = null)

setSet KEY (overwrite)

Set($key, $value, $expiration = 0, $timeout = null)

addAdd KEY (non-overwrite)

Add($key, $value, $expiration = 0, $timeout = null)

replace replaces a KEY

Replace($key, $value, $expiration = 0, $timeout = null)

append append data to the end

append($key, $value, $timeout = null)

prepend append data to the beginning

Prepend($key, $value, $timeout = null)

getGet KEY

Get($key, $timeout = null)

delete Delete a key

Delete($key, $timeout = null)

statsGet server status

Stats($type = null, $timeout = null)

versionGet the server version

Version(int $timeout = null)

flush Clear the cache

flush(int $expiration = null, int $timeout = null)