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

connInt64
errorMessageString
getFoundBool
incrOkBool

Methods

fn connect(host: String, port: Int64) → RedisClient
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 sendCommand(args: List<String>) → Nothing