| 1 |
<?php |
| 2 |
|
| 3 |
namespace Clue\React\Redis; |
| 4 |
|
| 5 |
use Evenement\EventEmitterInterface; |
| 6 |
use React\Promise\PromiseInterface; |
| 7 |
|
| 8 |
/** |
| 9 |
* Simple interface for executing redis commands |
| 10 |
* |
| 11 |
* @event error(Exception $error) |
| 12 |
* @event close() |
| 13 |
* |
| 14 |
* @event message($channel, $message) |
| 15 |
* @event subscribe($channel, $numberOfChannels) |
| 16 |
* @event unsubscribe($channel, $numberOfChannels) |
| 17 |
* |
| 18 |
* @event pmessage($pattern, $channel, $message) |
| 19 |
* @event psubscribe($channel, $numberOfChannels) |
| 20 |
* @event punsubscribe($channel, $numberOfChannels) |
| 21 |
*/ |
| 22 |
interface Client extends EventEmitterInterface |
| 23 |
{ |
| 24 |
/** |
| 25 |
* Invoke the given command and return a Promise that will be fulfilled when the request has been replied to |
| 26 |
* |
| 27 |
* This is a magic method that will be invoked when calling any redis |
| 28 |
* command on this instance. |
| 29 |
* |
| 30 |
* @param string $name |
| 31 |
* @param string[] $args |
| 32 |
* @return PromiseInterface Promise<mixed,Exception> |
| 33 |
*/ |
| 34 |
public function __call($name, $args); |
| 35 |
|
| 36 |
/** |
| 37 |
* end connection once all pending requests have been replied to |
| 38 |
* |
| 39 |
* @return void |
| 40 |
* @uses self::close() once all replies have been received |
| 41 |
* @see self::close() for closing the connection immediately |
| 42 |
*/ |
| 43 |
public function end(); |
| 44 |
|
| 45 |
/** |
| 46 |
* close connection immediately |
| 47 |
* |
| 48 |
* This will emit the "close" event. |
| 49 |
* |
| 50 |
* @return void |
| 51 |
* @see self::end() for closing the connection once the client is idle |
| 52 |
*/ |
| 53 |
public function close(); |
| 54 |
} |