redis
Generated by tinox doc
tinox.core.redis, split out of the bundled stdlib as a standalone tinox-central package.
Session cache
import tinox.core.redis
class Main
{
fnc main() -> Int32
{
let client: RedisClient = RedisClient::connect("localhost", 6379)
if (client.conn <= 0)
{
println("connect failed: " + client.errorMessage)
return 1
}
client.setEx("session:abc", "user-42", 3600)
let value: String = client.get("session:abc")
if (client.lastGetFound())
{
println("session:abc = " + value)
}
else
{
println("cache miss")
}
client.incr("visits:abc")
client.close()
return 0
}
}
fn httpConnReadLine(conn: Int64) → String
fn tinoxBytesToString(bytes: List<Int64>) → String
class RedisClient
Fields
conn | Int64 | |
errorMessage | String | |
getFound | Bool | |
incrOk | Bool | |
healthy | Bool | |
pooled | Bool |
Methods
fn connect(host: String, port: Int64) → RedisClient
fn connectTls(host: String, port: Int64, verify: Bool) → RedisClient
fnc open(host: String, port: Int64, tls: Bool, verify: Bool) → RedisClient
fnc pingReply(client: RedisClient) → String
fn ping() → Bool
fn get(key: String) → String
fn lastGetFound() → Bool
fn set(key: String, value: String) → Bool
fn setEx(key: String, value: String, ttlSeconds: Int64) → Bool
fn del(key: String) → Bool
fn expire(key: String, ttlSeconds: Int64) → Bool
fn incr(key: String) → Int64
fn lastIncrOk() → Bool
fn close() → Nothing
fn readLine() → String
fn command(args: List<String>) → RedisReply
fn auth(username: String, password: String) → Bool
fn commandList(args: List<String>) → List<String>
fn getReply(key: String) → RedisReply
fn sendCommand(args: List<String>) → Nothing
class RedisCluster
Fields
seeds | List<String> | |
slots | List<String> | |
clients | Map<String, RedisClient> | |
stale | Bool | |
errorMessage | String | |
authUser | String | |
authPassword | String | |
tls | Bool | |
tlsVerify | Bool | |
refreshes | Int64 | |
redirects | Int64 |
Methods
fn create(seeds: List<String>) → RedisCluster
fn authenticate(user: String, password: String) → RedisCluster
fn useTls(verify: Bool) → RedisCluster
fnc crc16(text: String) → Int64
fnc hashPart(key: String) → String
fnc slotFor(key: String) → Int64
fn dropClient(addr: String) → Nothing
fn nodeClient(addr: String) → RedisClient
fn refresh() → Bool
fn applyNodes(text: String, via: String) → Bool
fn failure(message: String) → RedisReply
fn command(key: String, args: List<String>) → RedisReply
fn get(key: String) → RedisReply
fn set(key: String, value: String) → RedisReply
fn setEx(key: String, value: String, ttlSeconds: Int64) → RedisReply
fn del(key: String) → RedisReply
fn incr(key: String) → RedisReply
fn close() → Nothing
class RedisMessage
Fields
kind | Int64 | |
topic | String | |
payload | String |
Methods
fn isMessage() → Bool
fn isTimeout() → Bool
fn isClosed() → Bool
class RedisPool
Fields
host | String | |
port | Int64 | |
max | Int64 | |
idle | List<RedisClient> | |
lock | Mutex | |
permits | Semaphore | |
closed | Bool | |
authUser | String | |
authPassword | String | |
tls | Bool | |
tlsVerify | Bool |
Methods
fn create(host: String, port: Int64, max: Int64) → RedisPool
fn authenticate(user: String, password: String) → RedisPool
fn useTls(verify: Bool) → RedisPool
fn failed(message: String) → RedisClient
fn acquire(timeoutMs: Int64) → RedisClient
fn release(client: RedisClient) → Nothing
fn close() → Nothing
class RedisReply
Fields
kind | Int64 | |
text | String |
Methods
fn isNil() → Bool
fn isValue() → Bool
fn isError() → Bool
fn isFailure() → Bool
class RedisSentinel
Fields
host | String | |
port | Int64 |
Methods
fn address(sentinel: String) → RedisSentinel
fn resolveMaster(sentinels: List<String>, masterName: String) → String
fn connectMaster(sentinels: List<String>, masterName: String) → RedisClient
fn httpConnWaitReadable(conn: Int64, ms: Int64) → Int64
class RedisSubscriber
Fields
host | String | |
port | Int64 | |
conn | Int64 | |
channels | List<String> | |
errorMessage | String | |
maxPayload | Int64 | |
badElement | Bool |
Methods
fn connect(host: String, port: Int64) → RedisSubscriber
fn dial() → Bool
fn sendCommand(args: List<String>) → Nothing
fn readElement() → String
fn readPush() → List<String>
fn fail(message: String) → Nothing
fn isOpen() → Bool
fn subscribe(names: List<String>) → Bool
fn unsubscribe(names: List<String>) → Bool
fn next(timeoutMs: Int64) → RedisMessage
fn reconnect() → Bool
fn close() → Nothing