crystal support for "redis-protocol.rb"
- Redis Protocol specification
- redis-protocol.rb
- crystal: 0.26.1
- RedisProtocol::Parse (0.1 ready)
- RedisProtocol::Request (maybe 0.2)
- RedisProtocol::Response (maybe 0.3)
Add this to your application's shard.yml
:
dependencies:
redis-protocol:
github: maiha/redis-protocol.cr
version: 0.1.1
require "redis-protocol"
resp = RedisProtocol.parse("+OK\r\n")
p resp # => RedisProtocol::RedisString(@raw="OK")
p resp.value # => "OK"
resp = RedisProtocol.parse("-Error message\r\n")
p resp # => RedisProtocol::RedisError(@raw="Error message")
p resp.value # => "Error message"
resp = RedisProtocol.parse(":1000\r\n")
p resp # => RedisProtocol::RedisInteger(@raw=1000)
p resp.value # => 1000
resp = RedisProtocol.parse("$6\r\nfoobar\r\n")
p resp # => RedisProtocol::RedisString(@raw="foobar")
p resp.value # => "foobar"
resp = RedisProtocol.parse("$-1\r\n")
p resp # => RedisProtocol::RedisNull()
p resp.value # => nil
resp = RedisProtocol.parse("*2\r\n$4\r\nkeys\r\n$1\r\n*\r\n")
p resp # => RedisProtocol::RedisArray(@raw=[RedisProtocol::RedisString(@raw="keys"), RedisProtocol::RedisString(@raw="*")])
p resp.value # => ["keys", "*"]
- Fork it ( https://github.com/maiha/redis-protocol.cr/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- https://github.com/maiha - creator, maintainer