Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 98a0399

Browse files
Updated documentation to include INCRBYFLOAT, HINCRBYFLOAT and the new optional argument to INFO
1 parent c9dbfeb commit 98a0399

File tree

1 file changed

+44
-3
lines changed

1 file changed

+44
-3
lines changed

README.markdown

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,24 @@ $redis->incr('key1'); /* 4 */
421421
$redis->incrBy('key1', 10); /* 14 */
422422
</pre>
423423

424+
## incrByFloat
425+
##### Description
426+
Increment the key with floating point precision.
427+
##### Parameters
428+
*key*
429+
*value*: (float) value that will be added to the key
430+
##### Return value
431+
*FLOAT* the new value
432+
##### Examples
433+
<pre>
434+
$redis->incrByFloat('key1', 1.5); /* key1 didn't exist, so it will now be 1.5 */
435+
436+
437+
$redis->incrByFloat('key1', 1.5); /* 3 */
438+
$redis->incrByFloat('key1', -1.5); /* 1.5 */
439+
$redis->incrByFloat('key1', 2.5); /* 3.5 */
440+
</pre>
441+
424442
## decr, decrBy
425443
##### Description
426444
Decrement the number stored at key by one. If the second argument is filled, it will be used as the integer value of the decrement.
@@ -1626,7 +1644,9 @@ var_dump($redis->sort('s', array('sort' => 'desc', 'store' => 'out'))); // (int)
16261644

16271645
## info
16281646
##### *Description*
1629-
Returns an associative array of strings and integers, with the following keys:
1647+
Returns an associative array from REDIS that provides information about the server. Passing
1648+
no arguments to INFO will call the standard REDIS INFO command, which returns information such
1649+
as the following:
16301650

16311651
* redis_version
16321652
* arch_bits
@@ -1642,13 +1662,17 @@ Returns an associative array of strings and integers, with the following keys:
16421662
* total_commands_processed
16431663
* role
16441664

1665+
You can pass a variety of options to INFO (per the Redis documentation), which will modify what is
1666+
returned.
16451667

16461668
##### *Parameters*
1647-
None.
1669+
*option*: The option to provide redis (e.g. "COMMANDSTATS", "CPU")
16481670

16491671
##### *Example*
16501672
<pre>
1651-
$redis->info();
1673+
$redis->info(); /* standard redis INFO command */
1674+
$redis->info("COMMANDSTATS"); /* Statistical information on the commands that have been run (>=2.6 only)
1675+
$redis->info("CPU"); /* just CPU information from Redis INFO */
16521676
</pre>
16531677

16541678
## resetStat
@@ -2301,6 +2325,23 @@ $redis->hIncrBy('h', 'x', 2); /* returns 2: h[x] = 2 now. */
23012325
$redis->hIncrBy('h', 'x', 1); /* h[x] ← 2 + 1. Returns 3 */
23022326
</pre>
23032327

2328+
## hIncrByFloat
2329+
##### Description
2330+
Increments the value of a hash member by the provided float value
2331+
##### Parameters
2332+
*key*
2333+
*member*
2334+
*value*: (float) value that will be added to the member's value
2335+
##### Return value
2336+
*FLOAT* the new value
2337+
##### Examples
2338+
<pre>
2339+
$redis->delete('h');
2340+
$redis->hIncrByFloat('h','x', 1.5); /* returns 1.5: h[x] = 1.5 now */
2341+
$redis->hIncrByFLoat('h', 'x', 1.5); /* returns 3.0: h[x] = 3.0 now */
2342+
$redis->hIncrByFloat('h', 'x', -3.0); /* returns 0.0: h[x] = 0.0 now */
2343+
</pre>
2344+
23042345
## hMset
23052346
##### Description
23062347
Fills in a whole hash. Non-string values are converted to string, using the standard `(string)` cast. NULL values are stored as empty strings.

0 commit comments

Comments
 (0)