Skip to content

Commit 906e462

Browse files
committed
Merge pull request phpredis#30 from ErikDubbelboer/master
Added resetStat function
2 parents c9a6ce2 + 26cf871 commit 906e462

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

README.markdown

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,7 @@ None.
13831383
<pre>
13841384
$redis->bgSave();
13851385
</pre>
1386+
13861387
## lastSave
13871388

13881389
##### *Description*
@@ -1622,6 +1623,30 @@ None.
16221623
$redis->info();
16231624
</pre>
16241625

1626+
## resetStat
1627+
##### *Description*
1628+
Resets the statistics reported by Redis using the INFO command (`info()` function).
1629+
1630+
These are the counters that are reset:
1631+
1632+
* Keyspace hits
1633+
* Keyspace misses
1634+
* Number of commands processed
1635+
* Number of connections received
1636+
* Number of expired keys
1637+
1638+
1639+
##### *Parameters*
1640+
None.
1641+
1642+
##### *Return value*
1643+
*BOOL*: `TRUE` in case of success, `FALSE` in case of failure.
1644+
1645+
##### *Example*
1646+
<pre>
1647+
$redis->resetStat();
1648+
</pre>
1649+
16251650
## ttl
16261651
##### *Description*
16271652
Returns the time to live left for a given key, in seconds. If the key doesn't exist, `FALSE` is returned.

php_redis.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ PHP_METHOD(Redis, auth);
9696
PHP_METHOD(Redis, ttl);
9797
PHP_METHOD(Redis, persist);
9898
PHP_METHOD(Redis, info);
99+
PHP_METHOD(Redis, resetStat);
99100
PHP_METHOD(Redis, select);
100101
PHP_METHOD(Redis, move);
101102
PHP_METHOD(Redis, zAdd);

redis.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ static zend_function_entry redis_functions[] = {
124124
PHP_ME(Redis, ttl, NULL, ZEND_ACC_PUBLIC)
125125
PHP_ME(Redis, persist, NULL, ZEND_ACC_PUBLIC)
126126
PHP_ME(Redis, info, NULL, ZEND_ACC_PUBLIC)
127+
PHP_ME(Redis, resetStat, NULL, ZEND_ACC_PUBLIC)
127128
PHP_ME(Redis, select, NULL, ZEND_ACC_PUBLIC)
128129
PHP_ME(Redis, move, NULL, ZEND_ACC_PUBLIC)
129130
PHP_ME(Redis, bgrewriteaof, NULL, ZEND_ACC_PUBLIC)
@@ -2931,6 +2932,16 @@ PHP_METHOD(Redis, info) {
29312932
}
29322933
/* }}} */
29332934

2935+
/* {{{ proto string Redis::resetStat()
2936+
*/
2937+
PHP_METHOD(Redis, resetStat)
2938+
{
2939+
char *cmd;
2940+
int cmd_len = redis_cmd_format_static(&cmd, "CONFIG", "s", "RESETSTAT", 9);
2941+
generic_empty_cmd(INTERNAL_FUNCTION_PARAM_PASSTHRU, cmd, cmd_len);
2942+
}
2943+
/* }}} */
2944+
29342945
/* {{{ proto bool Redis::select(long dbNumber)
29352946
*/
29362947
PHP_METHOD(Redis, select) {

0 commit comments

Comments
 (0)