You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-16Lines changed: 5 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
# redis-parser
6
6
7
-
A high performance redis parser solution built for [node_redis](https://github.com/NodeRedis/node_redis) and [ioredis](https://github.com/luin/ioredis).
7
+
A high performance javascript redis parser built for [node_redis](https://github.com/NodeRedis/node_redis) and [ioredis](https://github.com/luin/ioredis).
8
8
9
9
Generally all [RESP](http://redis.io/topics/protocol) data will be properly parsed by the parser.
10
10
@@ -30,8 +30,7 @@ new Parser(options);
30
30
*`returnError`: *function*; mandatory
31
31
*`returnFatalError`: *function*; optional, defaults to the returnError function
32
32
*`returnBuffers`: *boolean*; optional, defaults to false
33
-
*`name`: *'javascript'|'hiredis'|'auto'|null*; optional, defaults to hiredis and falls back to the js parser if not available or if the stringNumbers option is choosen. Setting this to 'auto' or null is going to automatically determine what parser is available and chooses that one.
34
-
*`stringNumbers`: *boolean*; optional, defaults to false. This is only available for the javascript parser at the moment!
33
+
*`stringNumbers`: *boolean*; optional, defaults to false
35
34
36
35
### Example
37
36
@@ -55,8 +54,7 @@ var parser = new Parser({
55
54
},
56
55
returnFatalError:function (err) {
57
56
lib.returnFatalError(err);
58
-
},
59
-
name:'auto'// This returns either the hiredis or the js parser instance depending on what's available
57
+
}
60
58
});
61
59
62
60
Library.prototype.streamHandler=function () {
@@ -82,30 +80,21 @@ var parser = new Parser({
82
80
returnError:function(err) {
83
81
lib.returnError(err);
84
82
},
85
-
name:'javascript', // Use the Javascript parser
86
83
stringNumbers:true, // Return all numbers as string instead of a js number
87
84
returnBuffers:true// All strings are returned as buffer e.g. <Buffer 48 65 6c 6c 6f>
88
85
});
89
86
90
87
// The streamHandler as above
91
88
```
92
89
93
-
## Further info
94
-
95
-
The [hiredis](https://github.com/redis/hiredis) parser is still the fasted parser for
96
-
Node.js and therefor used as default in redis-parser if the hiredis parser is available.
97
-
98
-
Otherwise the pure js NodeRedis parser is chosen that is almost as fast as the
99
-
hiredis parser besides some situations in which it'll be a bit slower.
100
-
101
90
## Protocol errors
102
91
103
-
To handle protocol errors (this is very unlikely to happen) gracefully you should add the returnFatalError option, reject any still running command (they might have been processed properly but the reply is just wrong), destroy the socket and reconnect.
92
+
To handle protocol errors (this is very unlikely to happen) gracefully you should add the returnFatalError option, reject any still running command (they might have been processed properly but the reply is just wrong), destroy the socket and reconnect. Be aware that while doing this, no new command may be added, so all new commands have to be buffered in the meanwhile.
104
93
Otherwise a chunk might still contain partial data of a following command that was already processed properly but answered in the same chunk as the command that resulted in the protocol error.
105
94
106
95
## Contribute
107
96
108
-
The js parser is already optimized but there are likely further optimizations possible.
97
+
The parser is already optimized but there are likely further optimizations possible.
Copy file name to clipboardExpand all lines: changelog.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,21 @@
1
+
## v.2.0.0 - 0x May, 2016
2
+
3
+
The javascript parser got completly rewritten by [Michael Diarmid](https://github.com/Salakar) and [Ruben Bridgewater](https://github.com/BridgeAR) and is now a lot faster than the hiredis parser.
4
+
Therefore the hiredis parser was removed and is only used for testing purposes and benchmarking comparison.
5
+
6
+
All Errors returned by the parser are from now on of class ReplyError
7
+
8
+
Features
9
+
10
+
- Added ReplyError Class
11
+
- Added parser benchmark
12
+
13
+
Removed
14
+
15
+
- Dropped support of hiredis
16
+
- The `name` option is "removed"
17
+
- It is still available for backwards compatibility but it is strongly recommended not to use it
0 commit comments