forked from clue/reactphp-redis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClient.php
63 lines (57 loc) · 1.69 KB
/
Client.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
namespace Clue\React\Redis;
use Evenement\EventEmitterInterface;
use React\Promise\PromiseInterface;
use Clue\Redis\Protocol\Model\ModelInterface;
/**
* Simple interface for executing redis commands
*
* @event data(ModelInterface $messageModel)
* @event error(Exception $error)
* @event close()
*
* @event message($channel, $message)
* @event subscribe($channel, $numberOfChannels)
* @event unsubscribe($channel, $numberOfChannels)
*
* @event pmessage($pattern, $channel, $message)
* @event psubscribe($channel, $numberOfChannels)
* @event punsubscribe($channel, $numberOfChannels)
*
* @event monitor(ModelInterface $statusModel)
*/
interface Client extends EventEmitterInterface
{
/**
* Invoke the given command and return a Promise that will be resolved when the request has been replied to
*
* This is a magic method that will be invoked when calling any redis
* command on this instance.
*
* @param string $name
* @param string[] $args
* @return PromiseInterface Promise<mixed, Exception>
*/
public function __call($name, $args);
/**
* Checks if the client is busy, i.e. still has any requests pending
*
* @return boolean
*/
public function isBusy();
/**
* end connection once all pending requests have been replied to
*
* @uses self::close() once all replies have been received
* @see self::close() for closing the connection immediately
*/
public function end();
/**
* close connection immediately
*
* This will emit the "close" event.
*
* @see self::end() for closing the connection once the client is idle
*/
public function close();
}