Skip to content
sync/async redis clients for Nim
Nim
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Set theme jekyll-theme-cayman Apr 27, 2019
src update docs Apr 27, 2019
tests disable zdbAPI tests Apr 27, 2019
README.md Add note on highlevel api origin Sep 22, 2018
redisclient.nimble Add docs task Apr 27, 2019

README.md

redisclient

Provides sync and async clients to communicate with redis servers using nim-redisparser

Executing commands

Sync

  let con = open("localhost", 6379.Port)
  echo $con.execCommand("PING", @[])
  echo $con.execCommand("SET", @["auser", "avalue"])
  echo $con.execCommand("GET", @["auser"])
  echo $con.execCommand("SCAN", @["0"])

Async

  let con = await openAsync("localhost", 6379.Port)
  echo await con.execCommand("PING", @[])
  echo await con.execCommand("SET", @["auser", "avalue"])
  echo await con.execCommand("GET", @["auser"])
  echo await con.execCommand("SCAN", @["0"])
  echo await con.execCommand("SET", @["auser", "avalue"])
  echo await con.execCommand("GET", @["auser"])
  echo await con.execCommand("SCAN", @["0"])

  await con.enqueueCommand("PING", @[])
  await con.enqueueCommand("PING", @[])
  await con.enqueueCommand("PING", @[])
  echo await con.commitCommands()
 

Pipelining

You can use enqueueCommand and commitCommands to make use of redis pipelining

  con.enqueueCommand("PING", @[])
  con.enqueueCommand("PING", @[])
  con.enqueueCommand("PING", @[])
  
  echo $con.commitCommands()

Roadmap

You can’t perform that action at this time.