All Projects → nrk → Predis Async

nrk / Predis Async

Licence: mit
Asynchronous PHP client library for Redis built on top of ReactPHP

Projects that are alternatives of or similar to Predis Async

Php Console Spinner
Colorful highly configurable spinner for php cli applications (suitable for async apps)
Stars: ✭ 225 (-36.44%)
Mutual labels:  async, asynchronous, reactphp
Php Watcher
Monitor for any changes in your php application and automatically restart it (suitable for async apps).
Stars: ✭ 303 (-14.41%)
Mutual labels:  async, asynchronous, reactphp
Recoil
Asynchronous coroutines for PHP 7.
Stars: ✭ 765 (+116.1%)
Mutual labels:  async, asynchronous, reactphp
Iguazu
✨ Iguazu is a simple Redux-powered Async Query engine
Stars: ✭ 186 (-47.46%)
Mutual labels:  async, asynchronous
Mlua
High level Lua 5.4/5.3/5.2/5.1 (including LuaJIT) bindings to Rust with async/await support
Stars: ✭ 176 (-50.28%)
Mutual labels:  async, asynchronous
Agkozak Zsh Prompt
A fast, asynchronous ZSH prompt with color ASCII indicators of Git, exit, SSH, virtual environment, and vi mode status. Framework-agnostic and customizable.
Stars: ✭ 182 (-48.59%)
Mutual labels:  async, asynchronous
Kubernetes asyncio
Python asynchronous client library for Kubernetes http://kubernetes.io/
Stars: ✭ 147 (-58.47%)
Mutual labels:  async, asynchronous
Crochet
Crochet: use Twisted anywhere!
Stars: ✭ 214 (-39.55%)
Mutual labels:  async, asynchronous
Aioquant
Asynchronous event I/O driven quantitative trading framework.
Stars: ✭ 188 (-46.89%)
Mutual labels:  async, asynchronous
Coerce Rs
Coerce - an asynchronous (async/await) Actor runtime and cluster framework for Rust
Stars: ✭ 231 (-34.75%)
Mutual labels:  async, asynchronous
Creed
Sophisticated and functionally-minded async with advanced features: coroutines, promises, ES2015 iterables, fantasy-land
Stars: ✭ 265 (-25.14%)
Mutual labels:  async, asynchronous
Thenextquant
Asynchronous driven quantitative trading framework.
Stars: ✭ 172 (-51.41%)
Mutual labels:  async, asynchronous
Metasync
Asynchronous Programming Library for JavaScript & Node.js
Stars: ✭ 164 (-53.67%)
Mutual labels:  async, asynchronous
Asyncorm
Fully Async ORM inspired in django's
Stars: ✭ 182 (-48.59%)
Mutual labels:  async, asynchronous
Falcon
A high-performance web server for Ruby, supporting HTTP/1, HTTP/2 and TLS.
Stars: ✭ 2,058 (+481.36%)
Mutual labels:  async, asynchronous
Drone Core
The core crate for Drone, an Embedded Operating System.
Stars: ✭ 263 (-25.71%)
Mutual labels:  async, asynchronous
Korio
Korio: Kotlin cORoutines I/O : Virtual File System + Async/Sync Streams + Async TCP Client/Server + WebSockets for Multiplatform Kotlin 1.3
Stars: ✭ 282 (-20.34%)
Mutual labels:  asynchronous, redis
Mobc
A generic connection pool for Rust with async/await support
Stars: ✭ 141 (-60.17%)
Mutual labels:  async, redis
Tascalate Concurrent
Implementation of blocking (IO-Bound) cancellable java.util.concurrent.CompletionStage and related extensions to java.util.concurrent.ExecutorService-s
Stars: ✭ 144 (-59.32%)
Mutual labels:  async, asynchronous
Zapi
基于swoole的异步轻量级api框架,内部封装全套mysql、redis、mongo、memcached异步客户端,可以轻松start、reload、stop,加入数据库的查询模块,框架已经封装好近乎同步写法,底层异步调用。现已支持异步mysql、异步redis、异步http请求.
Stars: ✭ 245 (-30.79%)
Mutual labels:  async, redis

Predis\Async

Software license Latest stable Latest development Monthly installs Build status HHVM support

Asynchronous (non-blocking) version of Predis, the full-featured PHP client library for Redis, built on top of React to handle evented I/O. By default Predis\Async does not require any additional C extension to work, but it can be optionally paired with phpiredis to sensibly lower the overhead of serializing and parsing the Redis protocol.

Predis\Async is currently under development but already works pretty well. The client foundation is being built on top of the event loop abstraction offered by React, an event-oriented framework for PHP that aims to provide everything needed to create reusable libraries and long-running applications using an evented approach powered by non-blocking I/O. This library is partially tested on HHVM, but support for this runtime should be considered experimental.

Contributions are highly welcome and appreciated, feel free to open pull-requests with fixes or just report issues if you encounter weird behaviors and blatant bugs.

Main features

  • Wide range of Redis versions supported (from 2.0 to 3.0 and unstable) using profiles.
  • Transparent key prefixing for all known Redis commands using a customizable prefixing strategy.
  • Abstraction for MULTI / EXEC transactions (Redis >= 2.0).
  • Abstraction for PUBLISH / SUBSCRIBE contexts (Redis >= 2.0).
  • Abstraction for MONITOR contexts (Redis >= 1.2).
  • Abstraction for Lua scripting (Redis >= 2.6).
  • Ability to connect to Redis using TCP/IP or UNIX domain sockets.
  • Redis connections can be established lazily, commands are queued while the client is connecting.
  • Flexible system for defining and registering custom sets of supported commands or profiles.

Installing

Predis\Async is available on Packagist. It is not required to have the phpiredis extension loaded as suggested since the client will work anyway using a pure-PHP protocol parser, but if the extension is detected at runtime then it will be automatically preferred over the slower default. It is possible to force the client to use the pure-PHP protocol parser even when the extension is detected simply by passing ['phpiredis' => false] in the array of client options.

Example

<?php
require __DIR__.'/../autoload.php';

$loop = new React\EventLoop\StreamSelectLoop();
$client = new Predis\Async\Client('tcp://127.0.0.1:6379', $loop);

$client->connect(function ($client) use ($loop) {
    echo "Connected to Redis, now listening for incoming messages...\n";

    $logger = new Predis\Async\Client('tcp://127.0.0.1:6379', $loop);

    $client->pubSubLoop('nrk:channel', function ($event) use ($logger) {
        $logger->rpush("store:{$event->channel}", $event->payload, function () use ($event) {
            echo "Stored message `{$event->payload}` from {$event->channel}.\n";
        });
    });
});

$loop->run();

Differences with Predis

Being an asynchronous client implementation, the underlying design of Predis\Async is different from the one of Predis which is a blocking implementation. Certain features have not been implemented yet (or cannot be implemented at all), just to name a few you will not find the usual abstractions for pipelining commands and creating cluster of nodes using client-side sharding. That said, they share a common style and a few basic classes so if you used Predis in the past you should feel at home.

Contributing

If you want to work on Predis\Async, it is highly recommended that you first run the test suite in order to check that everything is OK, and report strange behaviours or bugs. When modifying the code please make sure that no warnings or notices are emitted by PHP by running the interpreter in your development environment with the error_reporting variable set to E_ALL | E_STRICT.

The recommended way to contribute to Predis\Async is to fork the project on GitHub, create new topic branches on your newly created repository to fix or add features (possibly with tests covering your modifications) and then open a new pull request with a description of the applied changes. Obviously you can use any other Git hosting provider of your preference.

Please follow a few basic commit guidelines before opening pull requests.

Project

Author

License

The code for Predis\Async is distributed under the terms of the MIT license (see LICENSE).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].