Skip to content

Commit f30ddfd

Browse files
committed
add method psetex, unlink, unsubscribe, punsubscribe
1 parent 9985a35 commit f30ddfd

File tree

1 file changed

+53
-2
lines changed

1 file changed

+53
-2
lines changed

src/Redis.php

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,19 @@ public function set( $key, $value, $timeout = null ) {}
254254
*/
255255
public function setex( $key, $ttl, $value ) {}
256256

257+
/**
258+
* Set the value and expiration in milliseconds of a key.
259+
*
260+
* @see setex()
261+
* @param string $key
262+
* @param int $ttl, in milliseconds.
263+
* @param string $value
264+
* @return bool: TRUE if the command is successful.
265+
* @link http://redis.io/commands/psetex
266+
* @example $redis->psetex('key', 1000, 'value'); // sets key → value, with 1sec TTL.
267+
*/
268+
public function psetex( $key, $ttl, $value ) {}
269+
257270
/**
258271
* Set the string value in argument as value of the key if the key doesn't already exist in the database.
259272
*
@@ -298,6 +311,28 @@ public function del( $key1, $key2 = null, $key3 = null ) {}
298311
*/
299312
public function delete( $key1, $key2 = null, $key3 = null ) {}
300313

314+
/**
315+
* Delete a key asynchronously in another thread. Otherwise it is just as DEL, but non blocking.
316+
*
317+
* @see del()
318+
* @param string|array $key1
319+
* @param string $key2
320+
* @param string $key3
321+
* @return int Number of keys unlinked.
322+
*
323+
* @link https://redis.io/commands/unlink
324+
* @example
325+
* <pre>
326+
* $redis->set('key1', 'val1');
327+
* $redis->set('key2', 'val2');
328+
* $redis->set('key3', 'val3');
329+
* $redis->set('key4', 'val4');
330+
* $redis->unlink('key1', 'key2'); // return 2
331+
* $redis->unlink(array('key3', 'key4')); // return 2
332+
* </pre>
333+
*/
334+
public function unlink( $key1, $key2 = null, $key3 = null ) {}
335+
301336
/**
302337
* Enter and exit transactional mode.
303338
*
@@ -367,7 +402,7 @@ public function unwatch( ) {}
367402
/**
368403
* Subscribe to channels. Warning: this function will probably change in the future.
369404
*
370-
* @param array $channels an array of channels to subscribe to
405+
* @param array $channels an array of channels to subscribe
371406
* @param string | array $callback either a string or an array($instance, 'method_name').
372407
* The callback function receives 3 parameters: the redis instance, the channel name, and the message.
373408
* @return mixed Any non-null return value in the callback will be returned to the caller.
@@ -398,7 +433,7 @@ public function subscribe( $channels, $callback ) {}
398433
/**
399434
* Subscribe to channels by pattern
400435
*
401-
* @param array $patterns The number of elements removed from the set.
436+
* @param array $patterns an array of glob-style patterns to subscribe
402437
* @param string|array $callback Either a string or an array with an object and method.
403438
* The callback will get four arguments ($redis, $pattern, $channel, $message)
404439
* @param mixed Any non-null return value in the callback will be returned to the caller.
@@ -447,6 +482,22 @@ public function publish( $channel, $message ) {}
447482
*/
448483
public function pubsub( $keyword, $argument ) {}
449484

485+
/**
486+
* Stop listening for messages posted to the given channels.
487+
*
488+
* @param array $channels an array of channels to usubscribe
489+
* @link http://redis.io/commands/unsubscribe
490+
*/
491+
public function unsubscribe( $channels = null ) {}
492+
493+
/**
494+
* Stop listening for messages posted to the given channels.
495+
*
496+
* @param array $patterns an array of glob-style patterns to unsubscribe
497+
* @link http://redis.io/commands/punsubscribe
498+
*/
499+
public function punsubscribe( $patterns = null ) {}
500+
450501
/**
451502
* Verify if the specified key exists.
452503
*

0 commit comments

Comments
 (0)