Asynchronous Redis client for Nim that uses Nim asyncdispatch
Nim's asyncronous
I/O tooling. The client impements connection pool exactly the same way as nimongo
does.
$ nimble install https://github.com/SSPkrolik/asyncredis.git
First, create asynchronous Redis client, and perform connections establishment. All connections from pool try to connect to Redis server.
import asyncredis
let ar = newAsyncRedis("localhost", poolSize=1)
discard waitFor(ar.connect())
Asynchronous Redis client performs automated reconnection if disconnection happened during certain command execution.
proc makeGetSet(): Future[string] {.async.} =
discard await ar.SET("key", "value")
let val = await ar.GET("key")
return val
let res = waitFor(makeGetSet)
echo res
Command | Status | Notes |
---|---|---|
APPEND | ✅ | |
AUTH | ✅ | |
BGREWRITEAOF | ✅ | |
BGSAVE | ✅ | |
BITCOUNT | ✅ | |
BITFIELD | 🔴 | |
BITOP | ✅ | |
BITPOS | 🔴 | |
BLPOP | 🔴 | |
BRPOP | 🔴 | |
BRPOPLPUSH | 🔴 | |
CLIENT GETNAME | ✅ | |
CLIENT KILL | ✅ | |
CLIENT LIST | ✅ | |
CLIENT PAUSE | ✅ | |
CLIENT REPLY | ✅ | |
CLIENT SETNAME | ✅ | |
COMMAND | 🔴 | |
COMMAND COUNT | ✅ | |
DBSIZE | ✅ | |
DEBUG OBJECT | ✅ | |
DEBUG SEGFAULT | ✅ | |
DECR | ✅ | |
DECRBY | ✅ | |
DEL | ✅ | |
DISCARD | ✅ | Transaction |
DUMP | ✅ | |
ECHO | ✅ | |
FLUSHALL | ✅ | |
FLUSHDB | ✅ | |
GET | ✅ | |
KEYS | ✅ | |
INCR | ✅ | |
INCRBY | ✅ | |
INCRBYFLOAT | ✅ | |
LASTSAVE | ✅ | |
LPUSH | ✅ | |
LPUSHX | ✅ | |
LRANGE | ✅ | |
PING | ✅ | |
SET | ✅ | No TTL |
TIME | ✅ | |
TTL | ✅ | |
TYPE | ✅ |