1 | <?php |
||
27 | class PhpRedisStore extends AbstractRedisStore |
||
28 | { |
||
29 | /** |
||
30 | * Creates a store backed by a PhpRedis client. |
||
31 | * |
||
32 | * If no client is passed, a new one is created using the default server |
||
33 | * "127.0.0.1" and the default port 6379. |
||
34 | * |
||
35 | * @param Redis|null $client The client used to connect to Redis. |
||
36 | */ |
||
37 | 82 | public function __construct(Redis $client = null) |
|
38 | { |
||
39 | 82 | if (null === $client) { |
|
40 | 82 | $client = new Redis(); |
|
41 | 82 | $client->connect('127.0.0.1', 6379); |
|
42 | } |
||
43 | |||
44 | 82 | $this->client = $client; |
|
45 | 82 | } |
|
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | 39 | protected function clientNotFoundValue() |
|
54 | |||
55 | /** |
||
56 | * {@inheritdoc} |
||
57 | */ |
||
58 | 35 | protected function clientGet($key) |
|
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | 34 | protected function clientGetMultiple(array $keys) |
|
70 | |||
71 | /** |
||
72 | * {@inheritdoc} |
||
73 | */ |
||
74 | 54 | protected function clientSet($key, $value) |
|
78 | |||
79 | /** |
||
80 | * {@inheritdoc} |
||
81 | */ |
||
82 | 8 | protected function clientRemove($key) |
|
86 | |||
87 | /** |
||
88 | * {@inheritdoc} |
||
89 | */ |
||
90 | 29 | protected function clientExists($key) |
|
94 | |||
95 | /** |
||
96 | * {@inheritdoc} |
||
97 | */ |
||
98 | 82 | protected function clientClear() |
|
102 | |||
103 | /** |
||
104 | * {@inheritdoc} |
||
105 | */ |
||
106 | 4 | protected function clientKeys() |
|
110 | } |
||
111 |