amphp/redis

A non-blocking Redis client for Amp.

Fund package maintenance!
amphp

Installs: 185 068

Dependents: 22

Suggesters: 4

Security: 0

Stars: 135

Watchers: 11

Forks: 29

Open Issues: 3

v2.0.0-beta.3 2022-11-07 22:43 UTC

README

Build Status Coverage Status MIT License

amphp/redis provides non-blocking access to Redis instances. All I/O operations are handled by the Amp concurrency framework, so you should be familiar with the basics of it.

Installation

This package can be installed as a Composer dependency.

composer require amphp/redis

Usage

<?php

require __DIR__ . '/vendor/autoload.php';

use Amp\Redis\RedisConfig;
use Amp\Redis\Redis;
use Amp\Redis\RemoteExecutor;

Amp\Loop::run(static function () {
    $redis = new Redis(new RemoteExecutor(RedisConfig::fromUri('redis://')));

    yield $redis->set('foo', '21');
    $result = yield $redis->increment('foo', 21);

    \var_dump($result); // int(42)
});

Security

If you discover any security related issues, please email me@kelunik.com instead of using the issue tracker.

License

The MIT License (MIT). Please see LICENSE for more information.