Skip to content

Commit fe8e2fb

Browse files
committed
Add PEXPIRE.
1 parent 171a969 commit fe8e2fb

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

README.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,9 +1240,9 @@ $redis->get('x'); // → `FALSE`
12401240
##### *Description*
12411241
Same as rename, but will not replace a key if the destination already exists. This is the same behaviour as setNx.
12421242

1243-
## setTimeout, expire
1243+
## setTimeout, expire, pexpire
12441244
##### *Description*
1245-
Sets an expiration date (a timeout) on an item.
1245+
Sets an expiration date (a timeout) on an item. pexpire requires a TTL in milliseconds.
12461246

12471247
##### *Parameters*
12481248
*Key*: key. The key that will disappear.

php_redis.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ PHP_METHOD(Redis, sUnionStore);
8989
PHP_METHOD(Redis, sDiff);
9090
PHP_METHOD(Redis, sDiffStore);
9191
PHP_METHOD(Redis, setTimeout);
92+
PHP_METHOD(Redis, pexpire);
9293
PHP_METHOD(Redis, save);
9394
PHP_METHOD(Redis, bgSave);
9495
PHP_METHOD(Redis, lastSave);

redis.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2865,6 +2865,10 @@ PHPAPI void generic_expire_cmd(INTERNAL_FUNCTION_PARAMETERS, char *keyword, int
28652865
PHP_METHOD(Redis, setTimeout) {
28662866
generic_expire_cmd(INTERNAL_FUNCTION_PARAM_PASSTHRU, "EXPIRE", sizeof("EXPIRE")-1);
28672867
}
2868+
2869+
PHP_METHOD(Redis, pexpire) {
2870+
generic_expire_cmd(INTERNAL_FUNCTION_PARAM_PASSTHRU, "PEXPIRE", sizeof("PEXPIRE")-1);
2871+
}
28682872
/* }}} */
28692873

28702874
/* {{{ proto array Redis::expireAt(string key, int timestamp)

0 commit comments

Comments
 (0)