<commit_before># clue/redis-react [![Build Status](https://travis-ci.org/clue/php-redis-react.svg?branch=master)](https://travis-ci.org/clue/php-redis-react)

Async redis client implementation built on top of React PHP.

> Note: This project is in beta stage! Feel free to report any issues you encounter.

## Quickstart example

Once [installed](#install), you can use the following code to connect to your
local redis server and send some requests:

```php

$factory = new Factory($connector);
$factory->createClient()->then(function (Client $client) use ($loop) {
    $client->SET('greeting', 'Hello world');
    $client->APPEND('greeting', '!');
    
    $client->GET('greeting')->then(function ($greeting) {
        echo $greeting . PHP_EOL;
    });
    
    $client->INCR('invocation')->then(function ($n) {
        echo 'count: ' . $n . PHP_EOL;
    });
    
    // end connection once all pending requests have been resolved
    $client->end();
});

$loop->run();
```

## Install

The recommended way to install this library is [through composer](http://getcomposer.org). [New to composer?](http://getcomposer.org/doc/00-intro.md)

```JSON
{
    "require": {<commit_msg>Update readme example to use new ReponseApi<commit_after># clue/redis-react [![Build Status](https://travis-ci.org/clue/php-redis-react.svg?branch=master)](https://travis-ci.org/clue/php-redis-react)

Async redis client implementation built on top of React PHP.

> Note: This project is in beta stage! Feel free to report any issues you encounter.

## Quickstart example

Once [installed](#install), you can use the following code to connect to your
local redis server and send some requests:

```php

$factory = new Factory($connector);
$factory->createClient()->then(function (Client $client) use ($loop) {
    $api = new ResponseApi($client);
    
    $api->set('greeting', 'Hello world');
    $api->append('greeting', '!');
    
    $api->get('greeting')->then(function ($greeting) {
        echo $greeting . PHP_EOL;
    });
    
    $api->incr('invocation')->then(function ($n) {
        echo 'count: ' . $n . PHP_EOL;
    });
    
    // end connection once all pending requests have been resolved
    $api->end();
});

$loop->run();
```

## Install

The recommended way to install this library is [through composer](http://getcomposer.org). [New to composer?](http://getcomposer.org/doc/00-intro.md)

```JSON
{
    "require": {
{'fraction_non_alphanumeric': 0.16245337753833403, 'fraction_numerical': 0.0016576875259013675, 'mean_word_length': 3.7707509881422925, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2903529', 'n_tokens_mistral': 761, 'n_tokens_neox': 757, 'n_words': 211}