Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

redis@0.8.1

  • Loading branch information...
commit 245f28cd2392211d00ab899a0865ab0bd3230bd4 1 parent f72ca55
@isaacs isaacs authored
View
53 node_modules/redis/after.txt
@@ -0,0 +1,53 @@
+Client count: 5, node version: 0.8.1, server version: 2.4.2, parser: faster
+ PING, 1/5 min/max/avg/p95: 0/ 7/ 0.05/ 1.00 1109ms total, 18034.27 ops/sec
+ PING, 50/5 min/max/avg/p95: 0/ 5/ 0.84/ 2.00 339ms total, 58997.05 ops/sec
+ PING, 200/5 min/max/avg/p95: 0/ 8/ 3.12/ 5.00 313ms total, 63897.76 ops/sec
+ PING, 20000/5 min/max/avg/p95: 30/ 260/ 146.33/ 231.55 268ms total, 74626.87 ops/sec
+SET small str, 1/5 min/max/avg/p95: 0/ 2/ 0.06/ 1.00 1181ms total, 16934.80 ops/sec
+SET small str, 50/5 min/max/avg/p95: 0/ 2/ 0.88/ 2.00 355ms total, 56338.03 ops/sec
+SET small str, 200/5 min/max/avg/p95: 0/ 10/ 3.44/ 6.00 345ms total, 57971.01 ops/sec
+SET small str, 20000/5 min/max/avg/p95: 26/ 275/ 151.66/ 250.00 281ms total, 71174.38 ops/sec
+SET small buf, 1/5 min/max/avg/p95: 0/ 3/ 0.09/ 1.00 1815ms total, 11019.28 ops/sec
+SET small buf, 50/5 min/max/avg/p95: 0/ 7/ 2.82/ 5.00 1130ms total, 17699.12 ops/sec
+SET small buf, 200/5 min/max/avg/p95: 0/ 26/ 11.31/ 18.00 1136ms total, 17605.63 ops/sec
+SET small buf, 20000/5 min/max/avg/p95: 115/1176/ 670.93/1129.00 1180ms total, 16949.15 ops/sec
+GET small str, 1/5 min/max/avg/p95: 0/ 1/ 0.06/ 1.00 1173ms total, 17050.30 ops/sec
+GET small str, 50/5 min/max/avg/p95: 0/ 2/ 0.93/ 2.00 374ms total, 53475.94 ops/sec
+GET small str, 200/5 min/max/avg/p95: 0/ 7/ 3.56/ 6.00 359ms total, 55710.31 ops/sec
+GET small str, 20000/5 min/max/avg/p95: 33/ 284/ 161.19/ 259.00 291ms total, 68728.52 ops/sec
+GET small buf, 1/5 min/max/avg/p95: 0/ 1/ 0.06/ 1.00 1171ms total, 17079.42 ops/sec
+GET small buf, 50/5 min/max/avg/p95: 0/ 4/ 0.98/ 2.00 391ms total, 51150.90 ops/sec
+GET small buf, 200/5 min/max/avg/p95: 0/ 10/ 3.73/ 6.00 374ms total, 53475.94 ops/sec
+GET small buf, 20000/5 min/max/avg/p95: 31/ 273/ 154.25/ 250.00 279ms total, 71684.59 ops/sec
+SET large str, 1/5 min/max/avg/p95: 0/ 4/ 0.07/ 1.00 1513ms total, 13218.77 ops/sec
+SET large str, 50/5 min/max/avg/p95: 0/ 3/ 0.98/ 2.00 391ms total, 51150.90 ops/sec
+SET large str, 200/5 min/max/avg/p95: 0/ 8/ 3.63/ 6.00 366ms total, 54644.81 ops/sec
+SET large str, 20000/5 min/max/avg/p95: 136/ 312/ 206.93/ 283.00 465ms total, 43010.75 ops/sec
+SET large buf, 1/5 min/max/avg/p95: 0/ 4/ 0.09/ 1.00 1928ms total, 10373.44 ops/sec
+SET large buf, 50/5 min/max/avg/p95: 0/ 8/ 2.96/ 5.00 1187ms total, 16849.20 ops/sec
+SET large buf, 200/5 min/max/avg/p95: 0/ 23/ 11.55/ 19.00 1160ms total, 17241.38 ops/sec
+SET large buf, 20000/5 min/max/avg/p95: 123/1193/ 690.04/1139.55 1198ms total, 16694.49 ops/sec
+GET large str, 1/5 min/max/avg/p95: 0/ 1/ 0.06/ 1.00 1305ms total, 15325.67 ops/sec
+GET large str, 50/5 min/max/avg/p95: 0/ 4/ 1.25/ 2.00 504ms total, 39682.54 ops/sec
+GET large str, 200/5 min/max/avg/p95: 0/ 15/ 5.13/ 10.00 515ms total, 38834.95 ops/sec
+GET large str, 20000/5 min/max/avg/p95: 250/ 334/ 292.76/ 316.00 552ms total, 36231.88 ops/sec
+GET large buf, 1/5 min/max/avg/p95: 0/ 3/ 0.06/ 1.00 1318ms total, 15174.51 ops/sec
+GET large buf, 50/5 min/max/avg/p95: 0/ 7/ 1.24/ 2.00 497ms total, 40241.45 ops/sec
+GET large buf, 200/5 min/max/avg/p95: 0/ 21/ 5.40/ 16.00 543ms total, 36832.41 ops/sec
+GET large buf, 20000/5 min/max/avg/p95: 220/ 310/ 265.45/ 294.00 497ms total, 40241.45 ops/sec
+ INCR, 1/5 min/max/avg/p95: 0/ 11/ 0.06/ 1.00 1163ms total, 17196.90 ops/sec
+ INCR, 50/5 min/max/avg/p95: 0/ 3/ 0.90/ 2.00 362ms total, 55248.62 ops/sec
+ INCR, 200/5 min/max/avg/p95: 0/ 7/ 3.34/ 6.00 336ms total, 59523.81 ops/sec
+ INCR, 20000/5 min/max/avg/p95: 30/ 269/ 155.06/ 245.00 279ms total, 71684.59 ops/sec
+ LPUSH, 1/5 min/max/avg/p95: 0/ 1/ 0.06/ 1.00 1151ms total, 17376.19 ops/sec
+ LPUSH, 50/5 min/max/avg/p95: 0/ 3/ 0.87/ 2.00 349ms total, 57306.59 ops/sec
+ LPUSH, 200/5 min/max/avg/p95: 0/ 7/ 3.29/ 5.00 330ms total, 60606.06 ops/sec
+ LPUSH, 20000/5 min/max/avg/p95: 32/ 268/ 151.11/ 244.00 273ms total, 73260.07 ops/sec
+ LRANGE 10, 1/5 min/max/avg/p95: 0/ 2/ 0.07/ 1.00 1407ms total, 14214.64 ops/sec
+ LRANGE 10, 50/5 min/max/avg/p95: 0/ 4/ 1.16/ 2.00 466ms total, 42918.45 ops/sec
+ LRANGE 10, 200/5 min/max/avg/p95: 0/ 9/ 4.43/ 7.00 445ms total, 44943.82 ops/sec
+ LRANGE 10, 20000/5 min/max/avg/p95: 47/ 371/ 214.06/ 327.55 395ms total, 50632.91 ops/sec
+ LRANGE 100, 1/5 min/max/avg/p95: 0/ 1/ 0.15/ 1.00 2955ms total, 6768.19 ops/sec
+ LRANGE 100, 50/5 min/max/avg/p95: 1/ 9/ 3.15/ 5.00 1263ms total, 15835.31 ops/sec
+ LRANGE 100, 200/5 min/max/avg/p95: 0/ 33/ 12.28/ 24.00 1233ms total, 16220.60 ops/sec
+ LRANGE 100, 20000/5 min/max/avg/p95: 200/ 712/ 458.26/ 674.10 938ms total, 21321.96 ops/sec
View
54 node_modules/redis/after2.txt
@@ -0,0 +1,54 @@
+Client count: 5, node version: 0.8.1, server version: 2.4.2, parser: faster
+ PING, 1/5 min/max/avg/p95: 0/ 7/ 0.05/ 0.00 1115ms total, 17937.22 ops/sec
+ PING, 50/5 min/max/avg/p95: 0/ 5/ 0.88/ 2.00 352ms total, 56818.18 ops/sec
+ PING, 200/5 min/max/avg/p95: 0/ 7/ 3.16/ 5.00 318ms total, 62893.08 ops/sec
+ PING, 20000/5 min/max/avg/p95: 29/ 268/ 150.53/ 244.00 272ms total, 73529.41 ops/sec
+SET small str, 1/5 min/max/avg/p95: 0/ 2/ 0.06/ 0.00 1197ms total, 16708.44 ops/sec
+SET small str, 50/5 min/max/avg/p95: 0/ 2/ 0.91/ 2.00 364ms total, 54945.05 ops/sec
+SET small str, 200/5 min/max/avg/p95: 0/ 9/ 3.50/ 6.00 351ms total, 56980.06 ops/sec
+SET small str, 20000/5 min/max/avg/p95: 28/ 286/ 157.23/ 262.00 296ms total, 67567.57 ops/sec
+SET small buf, 1/5 min/max/avg/p95: 0/ 3/ 0.09/ 1.00 1804ms total, 11086.47 ops/sec
+SET small buf, 50/5 min/max/avg/p95: 0/ 9/ 2.92/ 5.00 1168ms total, 17123.29 ops/sec
+SET small buf, 200/5 min/max/avg/p95: 0/ 24/ 11.32/ 18.00 1137ms total, 17590.15 ops/sec
+SET small buf, 20000/5 min/max/avg/p95: 119/1158/ 664.55/1103.55 1163ms total, 17196.90 ops/sec
+GET small str, 1/5 min/max/avg/p95: 0/ 1/ 0.06/ 1.00 1168ms total, 17123.29 ops/sec
+GET small str, 50/5 min/max/avg/p95: 0/ 3/ 0.96/ 2.00 385ms total, 51948.05 ops/sec
+GET small str, 200/5 min/max/avg/p95: 0/ 11/ 3.75/ 6.00 377ms total, 53050.40 ops/sec
+GET small str, 20000/5 min/max/avg/p95: 34/ 282/ 160.74/ 258.00 288ms total, 69444.44 ops/sec
+GET small buf, 1/5 min/max/avg/p95: 0/ 2/ 0.06/ 1.00 1165ms total, 17167.38 ops/sec
+GET small buf, 50/5 min/max/avg/p95: 0/ 3/ 0.97/ 2.00 388ms total, 51546.39 ops/sec
+GET small buf, 200/5 min/max/avg/p95: 0/ 7/ 3.61/ 6.00 362ms total, 55248.62 ops/sec
+GET small buf, 20000/5 min/max/avg/p95: 31/ 274/ 158.89/ 250.00 280ms total, 71428.57 ops/sec
+SET large str, 1/5 min/max/avg/p95: 0/ 5/ 0.07/ 1.00 1524ms total, 13123.36 ops/sec
+SET large str, 50/5 min/max/avg/p95: 0/ 3/ 0.96/ 2.00 387ms total, 51679.59 ops/sec
+SET large str, 200/5 min/max/avg/p95: 0/ 10/ 3.71/ 6.00 373ms total, 53619.30 ops/sec
+SET large str, 20000/5 min/max/avg/p95: 130/ 261/ 186.07/ 238.00 440ms total, 45454.55 ops/sec
+SET large buf, 1/5 min/max/avg/p95: 0/ 2/ 0.09/ 1.00 1884ms total, 10615.71 ops/sec
+SET large buf, 50/5 min/max/avg/p95: 0/ 9/ 3.00/ 5.00 1202ms total, 16638.94 ops/sec
+SET large buf, 200/5 min/max/avg/p95: 0/ 23/ 11.59/ 19.00 1164ms total, 17182.13 ops/sec
+SET large buf, 20000/5 min/max/avg/p95: 117/1212/ 674.33/1150.10 1218ms total, 16420.36 ops/sec
+GET large str, 1/5 min/max/avg/p95: 0/ 3/ 0.07/ 1.00 1345ms total, 14869.89 ops/sec
+GET large str, 50/5 min/max/avg/p95: 0/ 5/ 1.29/ 2.00 516ms total, 38759.69 ops/sec
+GET large str, 200/5 min/max/avg/p95: 0/ 22/ 5.87/ 15.00 590ms total, 33898.31 ops/sec
+GET large str, 20000/5 min/max/avg/p95: 227/ 323/ 279.08/ 307.00 519ms total, 38535.65 ops/sec
+GET large buf, 1/5 min/max/avg/p95: 0/ 10/ 0.06/ 1.00 1330ms total, 15037.59 ops/sec
+GET large buf, 50/5 min/max/avg/p95: 0/ 12/ 1.28/ 2.00 514ms total, 38910.51 ops/sec
+GET large buf, 200/5 min/max/avg/p95: 0/ 21/ 5.60/ 13.00 562ms total, 35587.19 ops/sec
+GET large buf, 20000/5 min/max/avg/p95: 234/ 312/ 279.49/ 303.00 528ms total, 37878.79 ops/sec
+ INCR, 1/5 min/max/avg/p95: 0/ 2/ 0.06/ 1.00 1206ms total, 16583.75 ops/sec
+ INCR, 50/5 min/max/avg/p95: 0/ 3/ 0.90/ 2.00 361ms total, 55401.66 ops/sec
+ INCR, 200/5 min/max/avg/p95: 1/ 7/ 3.40/ 6.00 342ms total, 58479.53 ops/sec
+ INCR, 20000/5 min/max/avg/p95: 32/ 291/ 162.46/ 264.00 301ms total, 66445.18 ops/sec
+ LPUSH, 1/5 min/max/avg/p95: 0/ 1/ 0.06/ 1.00 1199ms total, 16680.57 ops/sec
+ LPUSH, 50/5 min/max/avg/p95: 0/ 3/ 0.91/ 2.00 365ms total, 54794.52 ops/sec
+ LPUSH, 200/5 min/max/avg/p95: 0/ 7/ 3.48/ 6.00 349ms total, 57306.59 ops/sec
+ LPUSH, 20000/5 min/max/avg/p95: 34/ 303/ 171.39/ 277.55 309ms total, 64724.92 ops/sec
+ LRANGE 10, 1/5 min/max/avg/p95: 0/ 2/ 0.07/ 1.00 1461ms total, 13689.25 ops/sec
+ LRANGE 10, 50/5 min/max/avg/p95: 0/ 5/ 1.20/ 2.00 482ms total, 41493.78 ops/sec
+ LRANGE 10, 200/5 min/max/avg/p95: 1/ 10/ 4.57/ 7.00 459ms total, 43572.98 ops/sec
+ LRANGE 10, 20000/5 min/max/avg/p95: 56/ 378/ 213.38/ 336.55 403ms total, 49627.79 ops/sec
+ LRANGE 100, 1/5 min/max/avg/p95: 0/ 2/ 0.14/ 1.00 2936ms total, 6811.99 ops/sec
+ LRANGE 100, 50/5 min/max/avg/p95: 1/ 6/ 3.07/ 5.00 1230ms total, 16260.16 ops/sec
+ LRANGE 100, 200/5 min/max/avg/p95: 0/ 33/ 12.35/ 23.00 1240ms total, 16129.03 ops/sec
+ LRANGE 100, 20000/5 min/max/avg/p95: 211/ 735/ 479.93/ 710.00 909ms total, 22002.20 ops/sec
+End of tests.
View
54 node_modules/redis/before.txt
@@ -0,0 +1,54 @@
+Client count: 5, node version: 0.8.1, server version: 2.4.2, parser: faster
+ PING, 1/5 min/max/avg/p95: 0/ 4/ 0.05/ 1.00 1127ms total, 17746.23 ops/sec
+ PING, 50/5 min/max/avg/p95: 0/ 5/ 0.82/ 2.00 327ms total, 61162.08 ops/sec
+ PING, 200/5 min/max/avg/p95: 0/ 7/ 3.03/ 5.00 304ms total, 65789.47 ops/sec
+ PING, 20000/5 min/max/avg/p95: 28/ 256/ 144.51/ 231.00 265ms total, 75471.70 ops/sec
+SET small str, 1/5 min/max/avg/p95: 0/ 3/ 0.06/ 1.00 1180ms total, 16949.15 ops/sec
+SET small str, 50/5 min/max/avg/p95: 0/ 3/ 0.91/ 2.00 366ms total, 54644.81 ops/sec
+SET small str, 200/5 min/max/avg/p95: 0/ 10/ 3.48/ 6.00 350ms total, 57142.86 ops/sec
+SET small str, 20000/5 min/max/avg/p95: 30/ 278/ 153.89/ 253.55 285ms total, 70175.44 ops/sec
+SET small buf, 1/5 min/max/avg/p95: 0/ 3/ 0.09/ 1.00 1838ms total, 10881.39 ops/sec
+SET small buf, 50/5 min/max/avg/p95: 0/ 9/ 2.86/ 5.00 1147ms total, 17436.79 ops/sec
+SET small buf, 200/5 min/max/avg/p95: 1/ 24/ 11.29/ 18.00 1134ms total, 17636.68 ops/sec
+SET small buf, 20000/5 min/max/avg/p95: 114/1170/ 665.26/1115.55 1175ms total, 17021.28 ops/sec
+GET small str, 1/5 min/max/avg/p95: 0/ 1/ 0.06/ 1.00 1183ms total, 16906.17 ops/sec
+GET small str, 50/5 min/max/avg/p95: 0/ 3/ 0.96/ 2.00 385ms total, 51948.05 ops/sec
+GET small str, 200/5 min/max/avg/p95: 0/ 7/ 3.61/ 6.00 363ms total, 55096.42 ops/sec
+GET small str, 20000/5 min/max/avg/p95: 34/ 288/ 162.52/ 265.00 296ms total, 67567.57 ops/sec
+GET small buf, 1/5 min/max/avg/p95: 0/ 1/ 0.06/ 1.00 1195ms total, 16736.40 ops/sec
+GET small buf, 50/5 min/max/avg/p95: 0/ 4/ 1.18/ 2.00 473ms total, 42283.30 ops/sec
+GET small buf, 200/5 min/max/avg/p95: 0/ 11/ 3.78/ 6.00 380ms total, 52631.58 ops/sec
+GET small buf, 20000/5 min/max/avg/p95: 32/ 271/ 151.82/ 241.55 279ms total, 71684.59 ops/sec
+SET large str, 1/5 min/max/avg/p95: 0/ 4/ 0.07/ 1.00 1560ms total, 12820.51 ops/sec
+SET large str, 50/5 min/max/avg/p95: 0/ 3/ 0.99/ 2.00 398ms total, 50251.26 ops/sec
+SET large str, 200/5 min/max/avg/p95: 1/ 11/ 3.70/ 6.00 373ms total, 53619.30 ops/sec
+SET large str, 20000/5 min/max/avg/p95: 145/ 279/ 204.35/ 266.00 468ms total, 42735.04 ops/sec
+SET large buf, 1/5 min/max/avg/p95: 0/ 4/ 0.09/ 1.00 1919ms total, 10422.09 ops/sec
+SET large buf, 50/5 min/max/avg/p95: 0/ 9/ 2.91/ 5.00 1167ms total, 17137.96 ops/sec
+SET large buf, 200/5 min/max/avg/p95: 1/ 24/ 11.50/ 18.00 1155ms total, 17316.02 ops/sec
+SET large buf, 20000/5 min/max/avg/p95: 121/1202/ 681.94/1128.10 1208ms total, 16556.29 ops/sec
+GET large str, 1/5 min/max/avg/p95: 0/ 1/ 0.06/ 1.00 1295ms total, 15444.02 ops/sec
+GET large str, 50/5 min/max/avg/p95: 0/ 4/ 1.24/ 2.00 498ms total, 40160.64 ops/sec
+GET large str, 200/5 min/max/avg/p95: 0/ 12/ 4.97/ 9.00 499ms total, 40080.16 ops/sec
+GET large str, 20000/5 min/max/avg/p95: 233/ 328/ 281.25/ 317.00 530ms total, 37735.85 ops/sec
+GET large buf, 1/5 min/max/avg/p95: 0/ 3/ 0.06/ 1.00 1312ms total, 15243.90 ops/sec
+GET large buf, 50/5 min/max/avg/p95: 0/ 9/ 1.28/ 2.00 512ms total, 39062.50 ops/sec
+GET large buf, 200/5 min/max/avg/p95: 0/ 21/ 5.70/ 14.00 572ms total, 34965.03 ops/sec
+GET large buf, 20000/5 min/max/avg/p95: 220/ 316/ 265.73/ 297.00 500ms total, 40000.00 ops/sec
+ INCR, 1/5 min/max/avg/p95: 0/ 11/ 0.06/ 1.00 1182ms total, 16920.47 ops/sec
+ INCR, 50/5 min/max/avg/p95: 0/ 3/ 0.90/ 2.00 360ms total, 55555.56 ops/sec
+ INCR, 200/5 min/max/avg/p95: 1/ 10/ 3.42/ 6.00 344ms total, 58139.53 ops/sec
+ INCR, 20000/5 min/max/avg/p95: 29/ 271/ 153.25/ 246.00 280ms total, 71428.57 ops/sec
+ LPUSH, 1/5 min/max/avg/p95: 0/ 2/ 0.06/ 1.00 1186ms total, 16863.41 ops/sec
+ LPUSH, 50/5 min/max/avg/p95: 0/ 3/ 0.92/ 2.00 369ms total, 54200.54 ops/sec
+ LPUSH, 200/5 min/max/avg/p95: 0/ 7/ 3.48/ 6.00 350ms total, 57142.86 ops/sec
+ LPUSH, 20000/5 min/max/avg/p95: 30/ 278/ 152.72/ 253.10 283ms total, 70671.38 ops/sec
+ LRANGE 10, 1/5 min/max/avg/p95: 0/ 3/ 0.07/ 1.00 1441ms total, 13879.25 ops/sec
+ LRANGE 10, 50/5 min/max/avg/p95: 0/ 3/ 1.20/ 2.00 482ms total, 41493.78 ops/sec
+ LRANGE 10, 200/5 min/max/avg/p95: 0/ 9/ 4.68/ 8.00 470ms total, 42553.19 ops/sec
+ LRANGE 10, 20000/5 min/max/avg/p95: 49/ 377/ 217.71/ 336.55 403ms total, 49627.79 ops/sec
+ LRANGE 100, 1/5 min/max/avg/p95: 0/ 1/ 0.15/ 1.00 2975ms total, 6722.69 ops/sec
+ LRANGE 100, 50/5 min/max/avg/p95: 0/ 12/ 3.29/ 5.00 1317ms total, 15186.03 ops/sec
+ LRANGE 100, 200/5 min/max/avg/p95: 0/ 34/ 13.23/ 26.00 1329ms total, 15048.91 ops/sec
+ LRANGE 100, 20000/5 min/max/avg/p95: 207/ 730/ 489.75/ 715.00 952ms total, 21008.40 ops/sec
+End of tests.
View
14 node_modules/redis/changelog.md
@@ -1,6 +1,20 @@
Changelog
=========
+## v0.8.1 - September 11, 2012
+
+Important bug fix for null responses (Jerry Sievert)
+
+## v0.8.0 - September 10, 2012
+
+Many contributed features and fixes, including:
+
+* Pure JavaScript reply parser that is usually faster than hiredis (Jerry Sievert)
+* Remove hiredis as optionalDependency from package.json. It still works if you want it.
+* Restore client state on reconnect, including select, subscribe, and monitor. (Ignacio Burgueño)
+* Fix idle event (Trae Robrock)
+* Many documentation improvements and bug fixes (David Trejo)
+
## v0.7.2 - April 29, 2012
Many contributed fixes. Thank you, contributors.
View
32 node_modules/redis/index.js
@@ -130,8 +130,7 @@ RedisClient.prototype.flush_and_error = function (message) {
};
RedisClient.prototype.on_error = function (msg) {
- var message = "Redis connection to " + this.host + ":" + this.port + " failed - " + msg,
- self = this, command_obj;
+ var message = "Redis connection to " + this.host + ":" + this.port + " failed - " + msg;
if (this.closing) {
return;
@@ -198,7 +197,6 @@ RedisClient.prototype.on_connect = function () {
if (exports.debug_mode) {
console.log("Stream connected " + this.host + ":" + this.port + " id " + this.connection_id);
}
- var self = this;
this.connected = true;
this.ready = false;
@@ -289,12 +287,12 @@ RedisClient.prototype.on_ready = function () {
if (this.pub_sub_mode === true) {
// only emit "ready" when all subscriptions were made again
var callback_count = 0;
- var callback = function() {
+ var callback = function () {
callback_count--;
- if (callback_count == 0) {
+ if (callback_count === 0) {
self.emit("ready");
}
- }
+ };
Object.keys(this.subscription_set).forEach(function (key) {
var parts = key.split(" ");
if (exports.debug_mode) {
@@ -389,7 +387,7 @@ RedisClient.prototype.send_offline_queue = function () {
};
RedisClient.prototype.connection_gone = function (why) {
- var self = this, message;
+ var self = this;
// If a retry is already in progress, just let that happen
if (this.retry_timer) {
@@ -562,7 +560,7 @@ function reply_to_strings(reply) {
}
RedisClient.prototype.return_reply = function (reply) {
- var command_obj, obj, i, len, type, timestamp, argindex, args, queue_len;
+ var command_obj, len, type, timestamp, argindex, args, queue_len;
command_obj = this.command_queue.shift(),
queue_len = this.command_queue.getLength();
@@ -646,7 +644,7 @@ function Command(command, args, sub_command, buffer_args, callback) {
}
RedisClient.prototype.send_command = function (command, args, callback) {
- var arg, this_args, command_obj, i, il, elem_count, buffer_args, stream = this.stream, command_str = "", buffered_writes = 0, last_arg_type;
+ var arg, command_obj, i, il, elem_count, buffer_args, stream = this.stream, command_str = "", buffered_writes = 0, last_arg_type;
if (typeof command !== "string") {
throw new Error("First argument to send_command must be the command name string, not " + typeof command);
@@ -948,8 +946,11 @@ RedisClient.prototype.hmset = function (args, callback) {
tmp_args.push(key);
if (typeof args[1][key] !== "string") {
var err = new Error("hmset expected value to be a string", key, ":", args[1][key]);
- if (callback) return callback(err);
- else throw err;
+ if (callback) {
+ return callback(err);
+ } else {
+ throw err;
+ }
}
tmp_args.push(args[1][key]);
}
@@ -1027,7 +1028,7 @@ Multi.prototype.exec = function (callback) {
}
}
- var i, il, j, jl, reply, args;
+ var i, il, reply, args;
if (replies) {
for (i = 1, il = self.queue.length; i < il; i += 1) {
@@ -1061,10 +1062,9 @@ RedisClient.prototype.MULTI = function (args) {
// stash original eval method
-var eval = RedisClient.prototype.eval;
+var eval_orig = RedisClient.prototype.eval;
// hook eval with an attempt to evalsha for cached scripts
-RedisClient.prototype.eval =
-RedisClient.prototype.EVAL = function () {
+RedisClient.prototype.eval = RedisClient.prototype.EVAL = function () {
var self = this,
args = to_array(arguments),
callback;
@@ -1080,7 +1080,7 @@ RedisClient.prototype.EVAL = function () {
self.evalsha(args, function (err, reply) {
if (err && /NOSCRIPT/.test(err.message)) {
args[0] = source;
- eval.call(self, args, callback);
+ eval_orig.call(self, args, callback);
} else if (callback) {
callback(err, reply);
View
12 node_modules/redis/lib/parser/hiredis.js
@@ -1,5 +1,3 @@
-/*global Buffer require exports console setTimeout */
-
var events = require("events"),
util = require("../util"),
hiredis = require("hiredis");
@@ -29,13 +27,15 @@ HiredisReplyParser.prototype.execute = function (data) {
this.reader.feed(data);
while (true) {
try {
- reply = this.reader.get();
+ reply = this.reader.get();
} catch (err) {
- this.emit("error", err);
- break;
+ this.emit("error", err);
+ break;
}
- if (reply === undefined) break;
+ if (reply === undefined) {
+ break;
+ }
if (reply && reply.constructor === Error) {
this.emit("reply error", reply);
View
507 node_modules/redis/lib/parser/javascript.js
@@ -1,317 +1,284 @@
-/*global Buffer require exports console setTimeout */
-
-// TODO - incorporate these V8 pro tips:
-// pre-allocate Arrays if length is known in advance
-// do not use delete
-// use numbers for parser state
-
var events = require("events"),
- util = require("../util");
+ util = require("../util");
+
+function Packet(type, size) {
+ this.type = type;
+ this.size = +size;
+}
+exports.name = "faster";
exports.debug_mode = false;
-exports.name = "javascript";
-function RedisReplyParser(options) {
+function ReplyParser(options) {
this.name = exports.name;
- this.options = options || {};
- this.reset();
- events.EventEmitter.call(this);
+ this.options = options || { };
+
+ this._buffer = null;
+ this._offset = 0;
+ this._encoding = "utf-8";
+ this._debug_mode = options.debug_mode;
+ this._reply_type = null;
}
-util.inherits(RedisReplyParser, events.EventEmitter);
+util.inherits(ReplyParser, events.EventEmitter);
-exports.Parser = RedisReplyParser;
+exports.Parser = ReplyParser;
// Buffer.toString() is quite slow for small strings
-function small_toString(buf, len) {
+function small_toString(buf, start, end) {
var tmp = "", i;
- for (i = 0; i < len; i += 1) {
+ for (i = start; i < end; i++) {
tmp += String.fromCharCode(buf[i]);
}
return tmp;
}
-// Reset parser to it's original state.
-RedisReplyParser.prototype.reset = function () {
- this.return_buffer = new Buffer(16384); // for holding replies, might grow
- this.return_string = "";
- this.tmp_string = ""; // for holding size fields
-
- this.multi_bulk_length = 0;
- this.multi_bulk_replies = null;
- this.multi_bulk_pos = 0;
- this.multi_bulk_nested_length = 0;
- this.multi_bulk_nested_replies = null;
-
- this.states = {
- TYPE: 1,
- SINGLE_LINE: 2,
- MULTI_BULK_COUNT: 3,
- INTEGER_LINE: 4,
- BULK_LENGTH: 5,
- ERROR_LINE: 6,
- BULK_DATA: 7,
- UNKNOWN_TYPE: 8,
- FINAL_CR: 9,
- FINAL_LF: 10,
- MULTI_BULK_COUNT_LF: 11,
- BULK_LF: 12
- };
-
- this.state = this.states.TYPE;
-};
+ReplyParser.prototype._parseResult = function (type) {
+ var start, end, offset, packetHeader;
+
+ if (type === 43 || type === 45) { // + or -
+ // up to the delimiter
+ end = this._packetEndOffset() - 1;
+ start = this._offset;
-RedisReplyParser.prototype.parser_error = function (message) {
- this.emit("error", message);
- this.reset();
-};
+ // include the delimiter
+ this._offset = end + 2;
-RedisReplyParser.prototype.execute = function (incoming_buf) {
- var pos = 0, bd_tmp, bd_str, i, il, states = this.states;
- //, state_times = {}, start_execute = new Date(), start_switch, end_switch, old_state;
- //start_switch = new Date();
-
- while (pos < incoming_buf.length) {
- // old_state = this.state;
- // console.log("execute: " + this.state + ", " + pos + "/" + incoming_buf.length + ", " + String.fromCharCode(incoming_buf[pos]));
-
- switch (this.state) {
- case 1: // states.TYPE
- this.type = incoming_buf[pos];
- pos += 1;
-
- switch (this.type) {
- case 43: // +
- this.state = states.SINGLE_LINE;
- this.return_buffer.end = 0;
- this.return_string = "";
- break;
- case 42: // *
- this.state = states.MULTI_BULK_COUNT;
- this.tmp_string = "";
- break;
- case 58: // :
- this.state = states.INTEGER_LINE;
- this.return_buffer.end = 0;
- this.return_string = "";
- break;
- case 36: // $
- this.state = states.BULK_LENGTH;
- this.tmp_string = "";
- break;
- case 45: // -
- this.state = states.ERROR_LINE;
- this.return_buffer.end = 0;
- this.return_string = "";
- break;
- default:
- this.state = states.UNKNOWN_TYPE;
- }
- break;
- case 4: // states.INTEGER_LINE
- if (incoming_buf[pos] === 13) {
- this.send_reply(+small_toString(this.return_buffer, this.return_buffer.end));
- this.state = states.FINAL_LF;
+ if (this.options.return_buffers) {
+ return this._buffer.slice(start, end);
+ } else {
+ if (end - start < 65536) { // completely arbitrary
+ return small_toString(this._buffer, start, end);
} else {
- this.return_buffer[this.return_buffer.end] = incoming_buf[pos];
- this.return_buffer.end += 1;
+ return this._buffer.toString(this._encoding, start, end);
}
- pos += 1;
- break;
- case 6: // states.ERROR_LINE
- if (incoming_buf[pos] === 13) {
- this.send_error(this.return_buffer.toString("ascii", 0, this.return_buffer.end));
- this.state = states.FINAL_LF;
- } else {
- this.return_buffer[this.return_buffer.end] = incoming_buf[pos];
- this.return_buffer.end += 1;
+ }
+ } else if (type === 58) { // :
+ // up to the delimiter
+ end = this._packetEndOffset() - 1;
+ start = this._offset;
+
+ // include the delimiter
+ this._offset = end + 2;
+
+ // return the coerced numeric value
+ return +small_toString(this._buffer, start, end);
+ } else if (type === 36) { // $
+ // set a rewind point, as the packet could be larger than the
+ // buffer in memory
+ offset = this._offset - 1;
+
+ packetHeader = new Packet(type, this.parseHeader());
+
+ // packets with a size of -1 are considered null
+ if (packetHeader.size === -1) {
+ return undefined;
+ }
+
+ end = this._offset + packetHeader.size;
+ start = this._offset;
+
+ // set the offset to after the delimiter
+ this._offset = end + 2;
+
+ if (end > this._buffer.length) {
+ this._offset = offset;
+ return null;
+ }
+
+ if (this.options.return_buffers) {
+ return this._buffer.slice(start, end);
+ } else {
+ return this._buffer.toString(this._encoding, start, end);
+ }
+ } else if (type === 42) { // *
+ offset = this._offset;
+ packetHeader = new Packet(type, this.parseHeader());
+
+ if (packetHeader.size > this._bytesRemaining()) {
+ this._offset = offset - 1;
+ return -1;
+ }
+
+ if (packetHeader.size < 0) {
+ this._offset += 2;
+ return null;
+ }
+
+ var reply = [ ];
+ var ntype, i, res;
+
+ offset = this._offset - 1;
+
+ for (i = 0; i < packetHeader.size; i++) {
+ ntype = this._buffer[this._offset++];
+
+ if (this._offset === this._buffer.length) {
+ throw new Error("too far");
}
- pos += 1;
- break;
- case 2: // states.SINGLE_LINE
- if (incoming_buf[pos] === 13) {
- this.send_reply(this.return_string);
- this.state = states.FINAL_LF;
- } else {
- this.return_string += String.fromCharCode(incoming_buf[pos]);
+ res = this._parseResult(ntype);
+ if (res === undefined) {
+ res = null;
}
- pos += 1;
- break;
- case 3: // states.MULTI_BULK_COUNT
- if (incoming_buf[pos] === 13) { // \r
- this.state = states.MULTI_BULK_COUNT_LF;
- } else {
- this.tmp_string += String.fromCharCode(incoming_buf[pos]);
+ reply.push(res);
+ }
+
+ return reply;
+ }
+};
+
+ReplyParser.prototype.execute = function (buffer) {
+ this.append(buffer);
+
+ var type, ret, offset;
+
+ while (true) {
+ offset = this._offset;
+ try {
+ // at least 4 bytes: :1\r\n
+ if (this._bytesRemaining() < 4) {
+ break;
}
- pos += 1;
- break;
- case 11: // states.MULTI_BULK_COUNT_LF
- if (incoming_buf[pos] === 10) { // \n
- if (this.multi_bulk_length) { // nested multi-bulk
- this.multi_bulk_nested_length = this.multi_bulk_length;
- this.multi_bulk_nested_replies = this.multi_bulk_replies;
- this.multi_bulk_nested_pos = this.multi_bulk_pos;
+
+ type = this._buffer[this._offset++];
+
+ if (type === 43) { // +
+ ret = this._parseResult(type);
+
+ if (ret === null) {
+ break;
}
- this.multi_bulk_length = +this.tmp_string;
- this.multi_bulk_pos = 0;
- this.state = states.TYPE;
- if (this.multi_bulk_length < 0) {
- this.send_reply(null);
- this.multi_bulk_length = 0;
- } else if (this.multi_bulk_length === 0) {
- this.multi_bulk_pos = 0;
- this.multi_bulk_replies = null;
- this.send_reply([]);
- } else {
- this.multi_bulk_replies = new Array(this.multi_bulk_length);
+
+ this.send_reply(ret);
+ } else if (type === 45) { // -
+ ret = this._parseResult(type);
+
+ if (ret === null) {
+ break;
}
- } else {
- this.parser_error(new Error("didn't see LF after NL reading multi bulk count"));
- return;
- }
- pos += 1;
- break;
- case 5: // states.BULK_LENGTH
- if (incoming_buf[pos] === 13) { // \r
- this.state = states.BULK_LF;
- } else {
- this.tmp_string += String.fromCharCode(incoming_buf[pos]);
- }
- pos += 1;
- break;
- case 12: // states.BULK_LF
- if (incoming_buf[pos] === 10) { // \n
- this.bulk_length = +this.tmp_string;
- if (this.bulk_length === -1) {
- this.send_reply(null);
- this.state = states.TYPE;
- } else if (this.bulk_length === 0) {
- this.send_reply(new Buffer(""));
- this.state = states.FINAL_CR;
- } else {
- this.state = states.BULK_DATA;
- if (this.bulk_length > this.return_buffer.length) {
- if (exports.debug_mode) {
- console.log("Growing return_buffer from " + this.return_buffer.length + " to " + this.bulk_length);
- }
- this.return_buffer = new Buffer(this.bulk_length);
- }
- this.return_buffer.end = 0;
+
+ this.send_error(ret);
+ } else if (type === 58) { // :
+ ret = this._parseResult(type);
+
+ if (ret === null) {
+ break;
}
- } else {
- this.parser_error(new Error("didn't see LF after NL while reading bulk length"));
- return;
- }
- pos += 1;
- break;
- case 7: // states.BULK_DATA
- this.return_buffer[this.return_buffer.end] = incoming_buf[pos];
- this.return_buffer.end += 1;
- pos += 1;
- if (this.return_buffer.end === this.bulk_length) {
- bd_tmp = new Buffer(this.bulk_length);
- // When the response is small, Buffer.copy() is a lot slower.
- if (this.bulk_length > 10) {
- this.return_buffer.copy(bd_tmp, 0, 0, this.bulk_length);
- } else {
- for (i = 0, il = this.bulk_length; i < il; i += 1) {
- bd_tmp[i] = this.return_buffer[i];
- }
+
+ this.send_reply(+ret);
+ } else if (type === 36) { // $
+ ret = this._parseResult(type);
+
+ if (ret === null) {
+ break;
}
- this.send_reply(bd_tmp);
- this.state = states.FINAL_CR;
- }
- break;
- case 9: // states.FINAL_CR
- if (incoming_buf[pos] === 13) { // \r
- this.state = states.FINAL_LF;
- pos += 1;
- } else {
- this.parser_error(new Error("saw " + incoming_buf[pos] + " when expecting final CR"));
- return;
- }
- break;
- case 10: // states.FINAL_LF
- if (incoming_buf[pos] === 10) { // \n
- this.state = states.TYPE;
- pos += 1;
- } else {
- this.parser_error(new Error("saw " + incoming_buf[pos] + " when expecting final LF"));
- return;
+
+ // check the state for what is the result of
+ // a -1, set it back up for a null reply
+ if (ret === undefined) {
+ ret = null;
+ }
+
+ this.send_reply(ret);
+ } else if (type === 42) { // *
+ // set a rewind point. if a failure occurs,
+ // wait for the next execute()/append() and try again
+ offset = this._offset - 1;
+
+ ret = this._parseResult(type);
+
+ if (ret === -1) {
+ this._offset = offset;
+ break;
+ }
+
+ this.send_reply(ret);
}
+ } catch (err) {
+ // catch the error (not enough data), rewind, and wait
+ // for the next packet to appear
+ this._offset = offset;
break;
- default:
- this.parser_error(new Error("invalid state " + this.state));
}
- // end_switch = new Date();
- // if (state_times[old_state] === undefined) {
- // state_times[old_state] = 0;
- // }
- // state_times[old_state] += (end_switch - start_switch);
- // start_switch = end_switch;
}
- // console.log("execute ran for " + (Date.now() - start_execute) + " ms, on " + incoming_buf.length + " Bytes. ");
- // Object.keys(state_times).forEach(function (state) {
- // console.log(" " + state + ": " + state_times[state]);
- // });
};
-RedisReplyParser.prototype.send_error = function (reply) {
- if (this.multi_bulk_length > 0 || this.multi_bulk_nested_length > 0) {
- // TODO - can this happen? Seems like maybe not.
- this.add_multi_bulk_reply(reply);
- } else {
- this.emit("reply error", reply);
+ReplyParser.prototype.append = function (newBuffer) {
+ if (!newBuffer) {
+ return;
}
-};
-RedisReplyParser.prototype.send_reply = function (reply) {
- if (this.multi_bulk_length > 0 || this.multi_bulk_nested_length > 0) {
- if (!this.options.return_buffers && Buffer.isBuffer(reply)) {
- this.add_multi_bulk_reply(reply.toString("utf8"));
- } else {
- this.add_multi_bulk_reply(reply);
- }
- } else {
- if (!this.options.return_buffers && Buffer.isBuffer(reply)) {
- this.emit("reply", reply.toString("utf8"));
- } else {
- this.emit("reply", reply);
- }
+ // first run
+ if (this._buffer === null) {
+ this._buffer = newBuffer;
+
+ return;
}
-};
-RedisReplyParser.prototype.add_multi_bulk_reply = function (reply) {
- if (this.multi_bulk_replies) {
- this.multi_bulk_replies[this.multi_bulk_pos] = reply;
- this.multi_bulk_pos += 1;
- if (this.multi_bulk_pos < this.multi_bulk_length) {
- return;
- }
+ // out of data
+ if (this._offset >= this._buffer.length) {
+ this._buffer = newBuffer;
+ this._offset = 0;
+
+ return;
+ }
+
+ // very large packet
+ // check for concat, if we have it, use it
+ if (Buffer.concat !== undefined) {
+ this._buffer = Buffer.concat([this._buffer.slice(this._offset), newBuffer]);
} else {
- this.multi_bulk_replies = reply;
+ var remaining = this._bytesRemaining(),
+ newLength = remaining + newBuffer.length,
+ tmpBuffer = new Buffer(newLength);
+
+ this._buffer.copy(tmpBuffer, 0, this._offset);
+ newBuffer.copy(tmpBuffer, remaining, 0);
+
+ this._buffer = tmpBuffer;
}
- if (this.multi_bulk_nested_length > 0) {
- this.multi_bulk_nested_replies[this.multi_bulk_nested_pos] = this.multi_bulk_replies;
- this.multi_bulk_nested_pos += 1;
+ this._offset = 0;
+};
+
+ReplyParser.prototype.parseHeader = function () {
+ var end = this._packetEndOffset(),
+ value = small_toString(this._buffer, this._offset, end - 1);
- this.multi_bulk_length = 0;
- this.multi_bulk_replies = null;
- this.multi_bulk_pos = 0;
+ this._offset = end + 1;
- if (this.multi_bulk_nested_length === this.multi_bulk_nested_pos) {
- this.emit("reply", this.multi_bulk_nested_replies);
- this.multi_bulk_nested_length = 0;
- this.multi_bulk_nested_pos = 0;
- this.multi_bulk_nested_replies = null;
+ return value;
+};
+
+ReplyParser.prototype._packetEndOffset = function () {
+ var offset = this._offset;
+
+ while (this._buffer[offset] !== 0x0d && this._buffer[offset + 1] !== 0x0a) {
+ offset++;
+
+ if (offset >= this._buffer.length) {
+ throw new Error("didn't see LF after NL reading multi bulk count (" + offset + " => " + this._buffer.length + ", " + this._offset + ")");
}
- } else {
- this.emit("reply", this.multi_bulk_replies);
- this.multi_bulk_length = 0;
- this.multi_bulk_replies = null;
- this.multi_bulk_pos = 0;
}
+
+ offset++;
+ return offset;
+};
+
+ReplyParser.prototype._bytesRemaining = function () {
+ return (this._buffer.length - this._offset) < 0 ? 0 : (this._buffer.length - this._offset);
+};
+
+ReplyParser.prototype.parser_error = function (message) {
+ this.emit("error", message);
};
+
+ReplyParser.prototype.send_error = function (reply) {
+ this.emit("reply error", reply);
+};
+
+ReplyParser.prototype.send_reply = function (reply) {
+ this.emit("reply", reply);
+};
View
8 node_modules/redis/lib/queue.js
@@ -1,5 +1,3 @@
-var to_array = require("./to_array");
-
// Queue class adapted from Tim Caswell's pattern library
// http://github.com/creationix/pattern/blob/master/lib/pattern/queue.js
@@ -49,13 +47,13 @@ Queue.prototype.getLength = function () {
return this.head.length - this.offset + this.tail.length;
};
-Object.defineProperty(Queue.prototype, 'length', {
+Object.defineProperty(Queue.prototype, "length", {
get: function () {
return this.getLength();
}
});
-if(typeof module !== 'undefined' && module.exports) {
- module.exports = Queue;
+if (typeof module !== "undefined" && module.exports) {
+ module.exports = Queue;
}
View
5 node_modules/redis/multi_bench.js
@@ -28,8 +28,6 @@ metrics.Histogram.prototype.print_line = function () {
};
function Test(args) {
- var self = this;
-
this.args = args;
this.callback = null;
@@ -46,7 +44,7 @@ function Test(args) {
}
Test.prototype.run = function (callback) {
- var self = this, i;
+ var i;
this.callback = callback;
@@ -120,7 +118,6 @@ Test.prototype.stop_clients = function () {
Test.prototype.send_next = function () {
var self = this,
cur_client = this.commands_sent % this.clients.length,
- command_num = this.commands_sent,
start = Date.now();
this.clients[cur_client][this.args.command](this.args.args, function (err, res) {
View
25 node_modules/redis/package.json
@@ -1,18 +1,18 @@
{
"name": "redis",
- "version": "0.7.3",
- "description": "Redis client library",
+ "version": "0.8.1",
+ "description": "Redis client library, battle-tested by Voxer",
+ "keywords": [
+ "redis",
+ "pub",
+ "sub",
+ "voxer",
+ "database"
+ ],
"author": {
"name": "Matt Ranney",
"email": "mjr@ranney.com"
},
- "maintainers": [
- {
- "name": "David Trejo",
- "email": "david.daniel.trejo@gmail.com",
- "url": "http://dtrejo.com/"
- }
- ],
"main": "./index.js",
"scripts": {
"test": "node ./test.js"
@@ -25,9 +25,6 @@
"url": "git://github.com/mranney/node_redis.git"
},
"readme": "redis - a node.js redis client\n===========================\n\nThis is a complete Redis client for node.js. It supports all Redis commands, including many recently added commands like EVAL from\nexperimental Redis server branches.\n\n\nInstall with:\n\n npm install redis\n\nPieter Noordhuis has provided a binding to the official `hiredis` C library, which is non-blocking and fast. To use `hiredis`, do:\n\n npm install hiredis redis\n\nIf `hiredis` is installed, `node_redis` will use it by default. Otherwise, a pure JavaScript parser will be used.\n\nIf you use `hiredis`, be sure to rebuild it whenever you upgrade your version of node. There are mysterious failures that can\nhappen between node and native code modules after a node upgrade.\n\n\n## Usage\n\nSimple example, included as `examples/simple.js`:\n\n```js\n var redis = require(\"redis\"),\n client = redis.createClient();\n\n // if you'd like to select database 3, instead of 0 (default), call\n // client.select(3, function() { /* ... */ });\n\n client.on(\"error\", function (err) {\n console.log(\"Error \" + err);\n });\n\n client.set(\"string key\", \"string val\", redis.print);\n client.hset(\"hash key\", \"hashtest 1\", \"some value\", redis.print);\n client.hset([\"hash key\", \"hashtest 2\", \"some other value\"], redis.print);\n client.hkeys(\"hash key\", function (err, replies) {\n console.log(replies.length + \" replies:\");\n replies.forEach(function (reply, i) {\n console.log(\" \" + i + \": \" + reply);\n });\n client.quit();\n });\n```\n\nThis will display:\n\n mjr:~/work/node_redis (master)$ node example.js\n Reply: OK\n Reply: 0\n Reply: 0\n 2 replies:\n 0: hashtest 1\n 1: hashtest 2\n mjr:~/work/node_redis (master)$\n\n\n## Performance\n\nHere are typical results of `multi_bench.js` which is similar to `redis-benchmark` from the Redis distribution.\nIt uses 50 concurrent connections with no pipelining.\n\nJavaScript parser:\n\n PING: 20000 ops 42283.30 ops/sec 0/5/1.182\n SET: 20000 ops 32948.93 ops/sec 1/7/1.515\n GET: 20000 ops 28694.40 ops/sec 0/9/1.740\n INCR: 20000 ops 39370.08 ops/sec 0/8/1.269\n LPUSH: 20000 ops 36429.87 ops/sec 0/8/1.370\n LRANGE (10 elements): 20000 ops 9891.20 ops/sec 1/9/5.048\n LRANGE (100 elements): 20000 ops 1384.56 ops/sec 10/91/36.072\n\nhiredis parser:\n\n PING: 20000 ops 46189.38 ops/sec 1/4/1.082\n SET: 20000 ops 41237.11 ops/sec 0/6/1.210\n GET: 20000 ops 39682.54 ops/sec 1/7/1.257\n INCR: 20000 ops 40080.16 ops/sec 0/8/1.242\n LPUSH: 20000 ops 41152.26 ops/sec 0/3/1.212\n LRANGE (10 elements): 20000 ops 36563.07 ops/sec 1/8/1.363\n LRANGE (100 elements): 20000 ops 21834.06 ops/sec 0/9/2.287\n\nThe performance of `node_redis` improves dramatically with pipelining, which happens automatically in most normal programs.\n\n\n### Sending Commands\n\nEach Redis command is exposed as a function on the `client` object.\nAll functions take either an `args` Array plus optional `callback` Function or\na variable number of individual arguments followed by an optional callback.\nHere is an example of passing an array of arguments and a callback:\n\n client.mset([\"test keys 1\", \"test val 1\", \"test keys 2\", \"test val 2\"], function (err, res) {});\n\nHere is that same call in the second style:\n\n client.mset(\"test keys 1\", \"test val 1\", \"test keys 2\", \"test val 2\", function (err, res) {});\n\nNote that in either form the `callback` is optional:\n\n client.set(\"some key\", \"some val\");\n client.set([\"some other key\", \"some val\"]);\n\nIf the key is missing, reply will be null (probably):\n\n client.get(\"missingkey\", function(err, reply) {\n // reply is null when the key is missing\n console.log(reply);\n });\n\nFor a list of Redis commands, see [Redis Command Reference](http://redis.io/commands)\n\nThe commands can be specified in uppercase or lowercase for convenience. `client.get()` is the same as `client.GET()`.\n\nMinimal parsing is done on the replies. Commands that return a single line reply return JavaScript Strings,\ninteger replies return JavaScript Numbers, \"bulk\" replies return node Buffers, and \"multi bulk\" replies return a\nJavaScript Array of node Buffers. `HGETALL` returns an Object with Buffers keyed by the hash keys.\n\n# API\n\n## Connection Events\n\n`client` will emit some events about the state of the connection to the Redis server.\n\n### \"ready\"\n\n`client` will emit `ready` a connection is established to the Redis server and the server reports\nthat it is ready to receive commands. Commands issued before the `ready` event are queued,\nthen replayed just before this event is emitted.\n\n### \"connect\"\n\n`client` will emit `connect` at the same time as it emits `ready` unless `client.options.no_ready_check`\nis set. If this options is set, `connect` will be emitted when the stream is connected, and then\nyou are free to try to send commands.\n\n### \"error\"\n\n`client` will emit `error` when encountering an error connecting to the Redis server.\n\nNote that \"error\" is a special event type in node. If there are no listeners for an\n\"error\" event, node will exit. This is usually what you want, but it can lead to some\ncryptic error messages like this:\n\n mjr:~/work/node_redis (master)$ node example.js\n\n node.js:50\n throw e;\n ^\n Error: ECONNREFUSED, Connection refused\n at IOWatcher.callback (net:870:22)\n at node.js:607:9\n\nNot very useful in diagnosing the problem, but if your program isn't ready to handle this,\nit is probably the right thing to just exit.\n\n`client` will also emit `error` if an exception is thrown inside of `node_redis` for whatever reason.\nIt would be nice to distinguish these two cases.\n\n### \"end\"\n\n`client` will emit `end` when an established Redis server connection has closed.\n\n### \"drain\"\n\n`client` will emit `drain` when the TCP connection to the Redis server has been buffering, but is now\nwritable. This event can be used to stream commands in to Redis and adapt to backpressure. Right now,\nyou need to check `client.command_queue.length` to decide when to reduce your send rate. Then you can\nresume sending when you get `drain`.\n\n### \"idle\"\n\n`client` will emit `idle` when there are no outstanding commands that are awaiting a response.\n\n## redis.createClient(port, host, options)\n\nCreate a new client connection. `port` defaults to `6379` and `host` defaults\nto `127.0.0.1`. If you have `redis-server` running on the same computer as node, then the defaults for\nport and host are probably fine. `options` in an object with the following possible properties:\n\n* `parser`: which Redis protocol reply parser to use. Defaults to `hiredis` if that module is installed.\nThis may also be set to `javascript`.\n* `return_buffers`: defaults to `false`. If set to `true`, then all replies will be sent to callbacks as node Buffer\nobjects instead of JavaScript Strings.\n* `detect_buffers`: default to `false`. If set to `true`, then replies will be sent to callbacks as node Buffer objects\nif any of the input arguments to the original command were Buffer objects.\nThis option lets you switch between Buffers and Strings on a per-command basis, whereas `return_buffers` applies to\nevery command on a client.\n* `socket_nodelay`: defaults to `true`. Whether to call setNoDelay() on the TCP stream, which disables the\nNagle algorithm on the underlying socket. Setting this option to `false` can result in additional throughput at the\ncost of more latency. Most applications will want this set to `true`.\n* `no_ready_check`: defaults to `false`. When a connection is established to the Redis server, the server might still\nbe loading the database from disk. While loading, the server not respond to any commands. To work around this,\n`node_redis` has a \"ready check\" which sends the `INFO` command to the server. The response from the `INFO` command\nindicates whether the server is ready for more commands. When ready, `node_redis` emits a `ready` event.\nSetting `no_ready_check` to `true` will inhibit this check.\n* `enable_offline_queue`: defaults to `true`. By default, if there is no active\nconnection to the redis server, commands are added to a queue and are executed\nonce the connection has been established. Setting `enable_offline_queue` to\n`false` will disable this feature and the callback will be execute immediately\nwith an error, or an error will be thrown if no callback is specified.\n\n```js\n var redis = require(\"redis\"),\n client = redis.createClient(null, null, {detect_buffers: true});\n\n client.set(\"foo_rand000000000000\", \"OK\");\n\n // This will return a JavaScript String\n client.get(\"foo_rand000000000000\", function (err, reply) {\n console.log(reply.toString()); // Will print `OK`\n });\n\n // This will return a Buffer since original key is specified as a Buffer\n client.get(new Buffer(\"foo_rand000000000000\"), function (err, reply) {\n console.log(reply.toString()); // Will print `<Buffer 4f 4b>`\n });\n client.end();\n```\n\n`createClient()` returns a `RedisClient` object that is named `client` in all of the examples here.\n\n## client.auth(password, callback)\n\nWhen connecting to Redis servers that require authentication, the `AUTH` command must be sent as the\nfirst command after connecting. This can be tricky to coordinate with reconnections, the ready check,\netc. To make this easier, `client.auth()` stashes `password` and will send it after each connection,\nincluding reconnections. `callback` is invoked only once, after the response to the very first\n`AUTH` command sent.\nNOTE: Your call to `client.auth()` should not be inside the ready handler. If\nyou are doing this wrong, `client` will emit an error that looks\nsomething like this `Error: Ready check failed: ERR operation not permitted`.\n\n## client.end()\n\nForcibly close the connection to the Redis server. Note that this does not wait until all replies have been parsed.\nIf you want to exit cleanly, call `client.quit()` to send the `QUIT` command after you have handled all replies.\n\nThis example closes the connection to the Redis server before the replies have been read. You probably don't\nwant to do this:\n\n```js\n var redis = require(\"redis\"),\n client = redis.createClient();\n\n client.set(\"foo_rand000000000000\", \"some fantastic value\");\n client.get(\"foo_rand000000000000\", function (err, reply) {\n console.log(reply.toString());\n });\n client.end();\n```\n\n`client.end()` is useful for timeout cases where something is stuck or taking too long and you want\nto start over.\n\n## Friendlier hash commands\n\nMost Redis commands take a single String or an Array of Strings as arguments, and replies are sent back as a single String or an Array of Strings.\nWhen dealing with hash values, there are a couple of useful exceptions to this.\n\n### client.hgetall(hash)\n\nThe reply from an HGETALL command will be converted into a JavaScript Object by `node_redis`. That way you can interact\nwith the responses using JavaScript syntax.\n\nExample:\n\n client.hmset(\"hosts\", \"mjr\", \"1\", \"another\", \"23\", \"home\", \"1234\");\n client.hgetall(\"hosts\", function (err, obj) {\n console.dir(obj);\n });\n\nOutput:\n\n { mjr: '1', another: '23', home: '1234' }\n\n### client.hmset(hash, obj, [callback])\n\nMultiple values in a hash can be set by supplying an object:\n\n client.HMSET(key2, {\n \"0123456789\": \"abcdefghij\", // NOTE: the key and value must both be strings\n \"some manner of key\": \"a type of value\"\n });\n\nThe properties and values of this Object will be set as keys and values in the Redis hash.\n\n### client.hmset(hash, key1, val1, ... keyn, valn, [callback])\n\nMultiple values may also be set by supplying a list:\n\n client.HMSET(key1, \"0123456789\", \"abcdefghij\", \"some manner of key\", \"a type of value\");\n\n\n## Publish / Subscribe\n\nHere is a simple example of the API for publish / subscribe. This program opens two\nclient connections, subscribes to a channel on one of them, and publishes to that\nchannel on the other:\n\n```js\n var redis = require(\"redis\"),\n client1 = redis.createClient(), client2 = redis.createClient(),\n msg_count = 0;\n\n client1.on(\"subscribe\", function (channel, count) {\n client2.publish(\"a nice channel\", \"I am sending a message.\");\n client2.publish(\"a nice channel\", \"I am sending a second message.\");\n client2.publish(\"a nice channel\", \"I am sending my last message.\");\n });\n\n client1.on(\"message\", function (channel, message) {\n console.log(\"client1 channel \" + channel + \": \" + message);\n msg_count += 1;\n if (msg_count === 3) {\n client1.unsubscribe();\n client1.end();\n client2.end();\n }\n });\n\n client1.incr(\"did a thing\");\n client1.subscribe(\"a nice channel\");\n```\n\nWhen a client issues a `SUBSCRIBE` or `PSUBSCRIBE`, that connection is put into \"pub/sub\" mode.\nAt that point, only commands that modify the subscription set are valid. When the subscription\nset is empty, the connection is put back into regular mode.\n\nIf you need to send regular commands to Redis while in pub/sub mode, just open another connection.\n\n## Pub / Sub Events\n\nIf a client has subscriptions active, it may emit these events:\n\n### \"message\" (channel, message)\n\nClient will emit `message` for every message received that matches an active subscription.\nListeners are passed the channel name as `channel` and the message Buffer as `message`.\n\n### \"pmessage\" (pattern, channel, message)\n\nClient will emit `pmessage` for every message received that matches an active subscription pattern.\nListeners are passed the original pattern used with `PSUBSCRIBE` as `pattern`, the sending channel\nname as `channel`, and the message Buffer as `message`.\n\n### \"subscribe\" (channel, count)\n\nClient will emit `subscribe` in response to a `SUBSCRIBE` command. Listeners are passed the\nchannel name as `channel` and the new count of subscriptions for this client as `count`.\n\n### \"psubscribe\" (pattern, count)\n\nClient will emit `psubscribe` in response to a `PSUBSCRIBE` command. Listeners are passed the\noriginal pattern as `pattern`, and the new count of subscriptions for this client as `count`.\n\n### \"unsubscribe\" (channel, count)\n\nClient will emit `unsubscribe` in response to a `UNSUBSCRIBE` command. Listeners are passed the\nchannel name as `channel` and the new count of subscriptions for this client as `count`. When\n`count` is 0, this client has left pub/sub mode and no more pub/sub events will be emitted.\n\n### \"punsubscribe\" (pattern, count)\n\nClient will emit `punsubscribe` in response to a `PUNSUBSCRIBE` command. Listeners are passed the\nchannel name as `channel` and the new count of subscriptions for this client as `count`. When\n`count` is 0, this client has left pub/sub mode and no more pub/sub events will be emitted.\n\n## client.multi([commands])\n\n`MULTI` commands are queued up until an `EXEC` is issued, and then all commands are run atomically by\nRedis. The interface in `node_redis` is to return an individual `Multi` object by calling `client.multi()`.\n\n```js\n var redis = require(\"./index\"),\n client = redis.createClient(), set_size = 20;\n\n client.sadd(\"bigset\", \"a member\");\n client.sadd(\"bigset\", \"another member\");\n\n while (set_size > 0) {\n client.sadd(\"bigset\", \"member \" + set_size);\n set_size -= 1;\n }\n\n // multi chain with an individual callback\n client.multi()\n .scard(\"bigset\")\n .smembers(\"bigset\")\n .keys(\"*\", function (err, replies) {\n // NOTE: code in this callback is NOT atomic\n // this only happens after the the .exec call finishes.\n client.mget(replies, redis.print);\n })\n .dbsize()\n .exec(function (err, replies) {\n console.log(\"MULTI got \" + replies.length + \" replies\");\n replies.forEach(function (reply, index) {\n console.log(\"Reply \" + index + \": \" + reply.toString());\n });\n });\n```\n\n`client.multi()` is a constructor that returns a `Multi` object. `Multi` objects share all of the\nsame command methods as `client` objects do. Commands are queued up inside the `Multi` object\nuntil `Multi.exec()` is invoked.\n\nYou can either chain together `MULTI` commands as in the above example, or you can queue individual\ncommands while still sending regular client command as in this example:\n\n```js\n var redis = require(\"redis\"),\n client = redis.createClient(), multi;\n\n // start a separate multi command queue\n multi = client.multi();\n multi.incr(\"incr thing\", redis.print);\n multi.incr(\"incr other thing\", redis.print);\n\n // runs immediately\n client.mset(\"incr thing\", 100, \"incr other thing\", 1, redis.print);\n\n // drains multi queue and runs atomically\n multi.exec(function (err, replies) {\n console.log(replies); // 101, 2\n });\n\n // you can re-run the same transaction if you like\n multi.exec(function (err, replies) {\n console.log(replies); // 102, 3\n client.quit();\n });\n```\n\nIn addition to adding commands to the `MULTI` queue individually, you can also pass an array\nof commands and arguments to the constructor:\n\n```js\n var redis = require(\"redis\"),\n client = redis.createClient(), multi;\n\n client.multi([\n [\"mget\", \"multifoo\", \"multibar\", redis.print],\n [\"incr\", \"multifoo\"],\n [\"incr\", \"multibar\"]\n ]).exec(function (err, replies) {\n console.log(replies);\n });\n```\n\n\n## Monitor mode\n\nRedis supports the `MONITOR` command, which lets you see all commands received by the Redis server\nacross all client connections, including from other client libraries and other computers.\n\nAfter you send the `MONITOR` command, no other commands are valid on that connection. `node_redis`\nwill emit a `monitor` event for every new monitor message that comes across. The callback for the\n`monitor` event takes a timestamp from the Redis server and an array of command arguments.\n\nHere is a simple example:\n\n```js\n var client = require(\"redis\").createClient(),\n util = require(\"util\");\n\n client.monitor(function (err, res) {\n console.log(\"Entering monitoring mode.\");\n });\n\n client.on(\"monitor\", function (time, args) {\n console.log(time + \": \" + util.inspect(args));\n });\n```\n\n# Extras\n\nSome other things you might like to know about.\n\n## client.server_info\n\nAfter the ready probe completes, the results from the INFO command are saved in the `client.server_info`\nobject.\n\nThe `versions` key contains an array of the elements of the version string for easy comparison.\n\n > client.server_info.redis_version\n '2.3.0'\n > client.server_info.versions\n [ 2, 3, 0 ]\n\n## redis.print()\n\nA handy callback function for displaying return values when testing. Example:\n\n```js\n var redis = require(\"redis\"),\n client = redis.createClient();\n\n client.on(\"connect\", function () {\n client.set(\"foo_rand000000000000\", \"some fantastic value\", redis.print);\n client.get(\"foo_rand000000000000\", redis.print);\n });\n```\n\nThis will print:\n\n Reply: OK\n Reply: some fantastic value\n\nNote that this program will not exit cleanly because the client is still connected.\n\n## redis.debug_mode\n\nBoolean to enable debug mode and protocol tracing.\n\n```js\n var redis = require(\"redis\"),\n client = redis.createClient();\n\n redis.debug_mode = true;\n\n client.on(\"connect\", function () {\n client.set(\"foo_rand000000000000\", \"some fantastic value\");\n });\n```\n\nThis will display:\n\n mjr:~/work/node_redis (master)$ node ~/example.js\n send command: *3\n $3\n SET\n $20\n foo_rand000000000000\n $20\n some fantastic value\n\n on_data: +OK\n\n`send command` is data sent into Redis and `on_data` is data received from Redis.\n\n## client.send_command(command_name, args, callback)\n\nUsed internally to send commands to Redis. For convenience, nearly all commands that are published on the Redis\nWiki have been added to the `client` object. However, if I missed any, or if new commands are introduced before\nthis library is updated, you can use `send_command()` to send arbitrary commands to Redis.\n\nAll commands are sent as multi-bulk commands. `args` can either be an Array of arguments, or omitted.\n\n## client.connected\n\nBoolean tracking the state of the connection to the Redis server.\n\n## client.command_queue.length\n\nThe number of commands that have been sent to the Redis server but not yet replied to. You can use this to\nenforce some kind of maximum queue depth for commands while connected.\n\nDon't mess with `client.command_queue` though unless you really know what you are doing.\n\n## client.offline_queue.length\n\nThe number of commands that have been queued up for a future connection. You can use this to enforce\nsome kind of maximum queue depth for pre-connection commands.\n\n## client.retry_delay\n\nCurrent delay in milliseconds before a connection retry will be attempted. This starts at `250`.\n\n## client.retry_backoff\n\nMultiplier for future retry timeouts. This should be larger than 1 to add more time between retries.\nDefaults to 1.7. The default initial connection retry is 250, so the second retry will be 425, followed by 723.5, etc.\n\n### Commands with Optional and Keyword arguments\n\nThis applies to anything that uses an optional `[WITHSCORES]` or `[LIMIT offset count]` in the [redis.io/commands](http://redis.io/commands) documentation.\n\nExample:\n```js\nvar args = [ 'myzset', 1, 'one', 2, 'two', 3, 'three', 99, 'ninety-nine' ];\nclient.zadd(args, function (err, response) {\n if (err) throw err;\n console.log('added '+response+' items.');\n\n // -Infinity and +Infinity also work\n var args1 = [ 'myzset', '+inf', '-inf' ];\n client.zrevrangebyscore(args1, function (err, response) {\n if (err) throw err;\n console.log('example1', response);\n // write your code here\n });\n\n var max = 3, min = 1, offset = 1, count = 2;\n var args2 = [ 'myzset', max, min, 'WITHSCORES', 'LIMIT', offset, count ];\n client.zrevrangebyscore(args2, function (err, response) {\n if (err) throw err;\n console.log('example2', response);\n // write your code here\n });\n});\n```\n\n## TODO\n\nBetter tests for auth, disconnect/reconnect, and all combinations thereof.\n\nStream large set/get values into and out of Redis. Otherwise the entire value must be in node's memory.\n\nPerformance can be better for very large values.\n\nI think there are more performance improvements left in there for smaller values, especially for large lists of small values.\n\n## How to Contribute\n- open a pull request and then wait for feedback (if\n [DTrejo](http://github.com/dtrejo) does not get back to you within 2 days,\n comment again with indignation!)\n\n## Contributors\nSome people have have added features and fixed bugs in `node_redis` other than me.\n\nOrdered by date of first contribution.\n[Auto-generated](http://github.com/dtrejo/node-authors) on Wed Jul 25 2012 19:14:59 GMT-0700 (PDT).\n\n- [Matt Ranney aka `mranney`](https://github.com/mranney)\n- [Tim-Smart aka `tim-smart`](https://github.com/tim-smart)\n- [Tj Holowaychuk aka `visionmedia`](https://github.com/visionmedia)\n- [rick aka `technoweenie`](https://github.com/technoweenie)\n- [Orion Henry aka `orionz`](https://github.com/orionz)\n- [Aivo Paas aka `aivopaas`](https://github.com/aivopaas)\n- [Hank Sims aka `hanksims`](https://github.com/hanksims)\n- [Paul Carey aka `paulcarey`](https://github.com/paulcarey)\n- [Pieter Noordhuis aka `pietern`](https://github.com/pietern)\n- [nithesh aka `nithesh`](https://github.com/nithesh)\n- [Andy Ray aka `andy2ray`](https://github.com/andy2ray)\n- [unknown aka `unknowdna`](https://github.com/unknowdna)\n- [Dave Hoover aka `redsquirrel`](https://github.com/redsquirrel)\n- [Vladimir Dronnikov aka `dvv`](https://github.com/dvv)\n- [Umair Siddique aka `umairsiddique`](https://github.com/umairsiddique)\n- [Louis-Philippe Perron aka `lp`](https://github.com/lp)\n- [Mark Dawson aka `markdaws`](https://github.com/markdaws)\n- [Ian Babrou aka `bobrik`](https://github.com/bobrik)\n- [Felix Geisendörfer aka `felixge`](https://github.com/felixge)\n- [Jean-Hugues Pinson aka `undefined`](https://github.com/undefined)\n- [Maksim Lin aka `maks`](https://github.com/maks)\n- [Owen Smith aka `orls`](https://github.com/orls)\n- [Zachary Scott aka `zzak`](https://github.com/zzak)\n- [TEHEK Firefox aka `TEHEK`](https://github.com/TEHEK)\n- [Isaac Z. Schlueter aka `isaacs`](https://github.com/isaacs)\n- [David Trejo aka `DTrejo`](https://github.com/DTrejo)\n- [Brian Noguchi aka `bnoguchi`](https://github.com/bnoguchi)\n- [Philip Tellis aka `bluesmoon`](https://github.com/bluesmoon)\n- [Marcus Westin aka `marcuswestin2`](https://github.com/marcuswestin2)\n- [Jed Schmidt aka `jed`](https://github.com/jed)\n- [Dave Peticolas aka `jdavisp3`](https://github.com/jdavisp3)\n- [Trae Robrock aka `trobrock`](https://github.com/trobrock)\n- [Shankar Karuppiah aka `shankar0306`](https://github.com/shankar0306)\n- [Ignacio Burgueño aka `ignacio`](https://github.com/ignacio)\n\nThanks.\n\n## LICENSE - \"MIT License\"\n\nCopyright (c) 2010 Matthew Ranney, http://ranney.com/\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\n![spacer](http://ranney.com/1px.gif)\n",
- "_id": "redis@0.7.3",
- "dist": {
- "shasum": "e314aa6bff4fad75d95b368c1259cd69158f9a74"
- },
- "_from": "redis@0.7.3"
+ "_id": "redis@0.8.1",
+ "_from": "redis@latest"
}
View
11 node_modules/redis/test.js
@@ -817,12 +817,19 @@ tests.DBSIZE = function () {
client.DBSIZE([], last(name, require_number_pos("DBSIZE")));
};
-tests.GET = function () {
- var name = "GET";
+tests.GET_1 = function () {
+ var name = "GET_1";
client.set(["get key", "get val"], require_string("OK", name));
client.GET(["get key"], last(name, require_string("get val", name)));
};
+tests.GET_2 = function() {
+ var name = "GET_2";
+
+ // tests handling of non-existent keys
+ client.GET('this_key_shouldnt_exist', last(name, require_null(name)));
+};
+
tests.SET = function () {
var name = "SET";
client.SET(["set key", "set val"], require_string("OK", name));
View
2  package.json
@@ -7,7 +7,7 @@
"dependencies": {
"request": "~2.9.202",
"marked": "~0.2.4",
- "redis": "~0.7.1",
+ "redis": "~0.8.1",
"lru-cache": "~2.0.0",
"cluster-master": "0",
"routes": "~0.1.1",
View
2  routes/forgot-password.js
@@ -188,7 +188,7 @@ function handle (req, res) {
.split('/').join('_')
.split('+').join('-')
, hash = sha(token)
- , data = { name: name, email: email, token: token }
+ , data = { name: name + '', email: email + '', token: token + '' }
, key = 'pwrecover_' + hash
config.redis.client.hmset(key, data, function (er) {
Please sign in to comment.
Something went wrong with that request. Please try again.