]> git.saurik.com Git - redis.git/blame - client-libraries/erlang/src/proto.erl
FLUSHALL/FLUSHDB no longer sync on disk. Just increment the dirty counter by the...
[redis.git] / client-libraries / erlang / src / proto.erl
CommitLineData
ed9b544e 1-module(proto).
2
91668668 3-export([parse/2]).
ed9b544e 4
5parse(empty, "+OK") ->
6 ok;
7parse(empty, "+PONG") ->
8 pong;
91668668 9parse(empty, ":0") ->
ed9b544e 10 false;
91668668 11parse(empty, ":1") ->
ed9b544e 12 true;
ed9b544e 13parse(empty, "-" ++ Message) ->
ed9b544e 14 {error, Message};
91668668 15parse(empty, "$-1") ->
16 {read, nil};
17parse(empty, "*-1") ->
18 {hold, nil};
19parse(empty, "$" ++ BulkSize) ->
20 {read, list_to_integer(BulkSize)};
21parse(read, "$" ++ BulkSize) ->
22 {read, list_to_integer(BulkSize)};
23parse(empty, "*" ++ MultiBulkSize) ->
24 {hold, list_to_integer(MultiBulkSize)};
25parse(empty, Message) ->
26 convert(Message).
27
28convert(":" ++ Message) ->
29 list_to_integer(Message);
30% in case the message is not OK or PONG it's a
31% real value that we don't know how to convert
32% to an atom, so just pass it as is and remove
33% the +
34convert("+" ++ Message) ->
35 Message;
36convert(Message) ->
ed9b544e 37 Message.
38