Comparing version 0.1.14 to 0.1.15
@@ -0,1 +1,9 @@ | ||
### 0.11.0 | ||
* Increase the maximum multi-bulk reply depth to 8. | ||
* Increase the read buffer size from 2k to 16k. | ||
* Use poll(2) instead of select(2) to support large fds (>= 1024). | ||
### 0.10.1 | ||
@@ -2,0 +10,0 @@ |
@@ -76,3 +76,3 @@ # HIREDIS | ||
reply = redisCommand("SET key:%s %s", myid, value); | ||
reply = redisCommand(context, "SET key:%s %s", myid, value); | ||
@@ -324,2 +324,6 @@ ### Using replies | ||
The same set of functions are used internally by hiredis when creating a | ||
normal Redis context, the above API just exposes it to the user for a direct | ||
usage. | ||
### Usage | ||
@@ -351,2 +355,25 @@ | ||
### Reader max buffer | ||
Both when using the Reader API directly or when using it indirectly via a | ||
normal Redis context, the redisReader structure uses a buffer in order to | ||
accumulate data from the server. | ||
Usually this buffer is destroyed when it is empty and is larger than 16 | ||
kb in order to avoid wasting memory in unused buffers | ||
However when working with very big payloads destroying the buffer may slow | ||
down performances considerably, so it is possible to modify the max size of | ||
an idle buffer changing the value of the `maxbuf` field of the reader structure | ||
to the desired value. The special value of 0 means that there is no maximum | ||
value for an idle buffer, so the buffer will never get freed. | ||
For instance if you have a normal Redis context you can set the maximum idle | ||
buffer to zero (unlimited) just with: | ||
context->reader->maxbuf = 0; | ||
This should be done only in order to maximize performances when working with | ||
large payloads. The context should be set back to `REDIS_READER_MAX_BUF` again | ||
as soon as possible in order to prevent allocation of useless memory. | ||
## AUTHORS | ||
@@ -353,0 +380,0 @@ |
@@ -1,9 +0,4 @@ | ||
var hiredis, net = require("net"); | ||
var net = require("net"), | ||
hiredis = require('bindings')('hiredis.node'); | ||
try { | ||
hiredis = require('./build/Release/hiredis'); | ||
} catch (e) { | ||
hiredis = require('./build/default/hiredis'); | ||
} | ||
exports.Reader = hiredis.Reader; | ||
@@ -10,0 +5,0 @@ exports.createConnection = function(port, host) { |
{ | ||
"name": "hiredis", | ||
"description": "Wrapper for reply processing code in hiredis", | ||
"version": "0.1.14", | ||
"version": "0.1.15", | ||
"homepage": "http://github.com/pietern/hiredis-node", | ||
"author": "Pieter Noordhuis <pcnoordhuis@gmail.com>", | ||
"main": "hiredis", | ||
"directories": { | ||
"lib": "." | ||
}, | ||
"scripts": { | ||
"preinstall": "make || gmake", | ||
"test": "node test/reader.js" | ||
}, | ||
"dependencies": { | ||
"bindings": "*" | ||
}, | ||
"engines": { | ||
"node": "*" | ||
"node": ">= 0.6.0" | ||
} | ||
} |
var assert = require("assert"), | ||
hiredis = require("../hiredis"); | ||
/* Monkey-patch Buffer.isBuffer on 0.3.1 */ | ||
if (process.versions.node == "0.3.1") { | ||
var SlowBuffer = process.binding('buffer').SlowBuffer; | ||
Buffer.isBuffer = function isBuffer(b) { | ||
return b instanceof Buffer || b instanceof SlowBuffer; | ||
}; | ||
} | ||
var passed = 0; | ||
@@ -130,2 +122,35 @@ var failed = 0; | ||
test("DeeplyNestedMultiBulkReply", function() { | ||
var i; | ||
var reader = new hiredis.Reader(); | ||
var expected = 1; | ||
for (i = 0; i < 8; i++) { | ||
reader.feed("*1\r\n"); | ||
expected = [expected]; | ||
} | ||
reader.feed(":1\r\n"); | ||
assert.deepEqual(reader.get(), expected); | ||
}); | ||
test("TooDeeplyNestedMultiBulkReply", function() { | ||
var i; | ||
var reader = new hiredis.Reader(); | ||
for (i = 0; i < 9; i++) { | ||
reader.feed("*1\r\n"); | ||
} | ||
reader.feed(":1\r\n"); | ||
assert.throws( | ||
function() { | ||
reader.get(); | ||
}, | ||
/nested multi/ | ||
); | ||
}); | ||
test("MultiBulkReplyWithNonStringValues", function() { | ||
@@ -132,0 +157,0 @@ var reader = new hiredis.Reader(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code which could be a vector to obscure malicious code, and generally decrease the likelihood of reproducible or reliable installs.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
202337
63
1
302
1
3
+ Addedbindings@*
+ Addedbindings@1.5.0(transitive)
+ Addedfile-uri-to-path@1.0.0(transitive)