This is my first try with erlang, so no high quality code to expect.
It is untested and has some bugs.
Feel free to fork away and improve it ;)
First connect is as easy as you think:
Sock = redis:connect().
This connects to the redis server running on localhost:6379
now you can call the commands:
1> redis:set(Sock, "foo", "bar"). ok 2> redis:keys(Sock). ["foo"] 3> redis:get(Sock, "foo"). "bar" 4> redis:exists(Sock, "bar"). false 5> redis:size(Sock). 1 6> redis:incr(Sock, "counter"). 1 7> redis:incr(Sock, "counter"). 2 8> redis:incrby(Sock, "counter", 3). 5 9> ...
So far the following commands are implemented (but not fully tested ;))
- KEYS (fails if given DATA size is > 9, pattern matching needs improvement)
- INFO (parsed into List, but given DATA size is ignored)
according to the Command Reference there are a lot missing.
What is missing?
- implementation of more/all commands
- bug fixes
- correctly handle bulk responses
Jan-Erik Rediger :: @badboy_