Skip to content

Instantly share code, notes, and snippets.

@niv

niv/redis.nim Secret

Created April 26, 2016 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niv/9d4ad9fff35c57d36454bb799e83eaf3 to your computer and use it in GitHub Desktop.
Save niv/9d4ad9fff35c57d36454bb799e83eaf3 to your computer and use it in GitHub Desktop.
proc rawCommand*(redis: Redis, command: seq[string]):
Future[RedisReply] {.async.} =
## Execute a redis command.
await Future[void](redis.socketAvailable)
FutureVar[void](redis.socketAvailable).clean()
redis.socketAvailable.cb = proc () = discard
try:
await redis.writeCommand(command)
result = await readResponse(redis)
finally:
redis.socketAvailable.complete()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment