Created
May 28, 2020 00:20
-
-
Save jgaskins/bdeb21f8797cc42b7b577554feb47a50 to your computer and use it in GitHub Desktop.
Adding stream support to Crystal Redis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Redis | |
module Commands | |
def xadd(stream, id, params : Hash) | |
params = params.each_with_object(Array(String).new(params.size * 2)) do |(key, value), array| | |
array << key << value.to_s | |
end | |
string_command(["XADD", stream, id] + params) | |
end | |
def xrange(stream, start, finish) | |
string_array_command(["XRANGE", stream, start, finish]) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment