Available

amalgame-redis

Pure RESP2 client, no vendored lib. KeyDB/Dragonfly/Valkey compat.

amc package add redis GitHub ↗ ← Back to the ecosystem

Overview

The RESP2 protocol is written in the package, straight over raw TCP, on top of Amalgame's network layer. No client library (no hiredis), no system dependency. Compatible with Redis, KeyDB, Dragonfly, Valkey and any server speaking RESP2.

Features

  • ✓RESP2 protocol written in the package: no hiredis to install
  • ✓Set / Get / Del / Exists / Incr / Decr / Expire / Ping API
  • ✓Works with Redis, KeyDB, Dragonfly, Valkey — one client
  • ✓Pub/sub and pipelining (v0.3.0)

Planned

  • ◐AUTH and database selection (SELECT)
  • ◐MULTI / EXEC transactions
  • ◐TLS

Example

Minimal usage example — copy-paste runnable after install.

import Amalgame.Database.NoSQL.Redis

public class Program {
    public static void Main() {
        let r = Redis.Open("127.0.0.1", 6379)
        if (!Redis.IsOpen(r)) {
            Console.WriteLine("connect failed: " + Redis.LastError(r))
            return
        }
        Redis.Set(r, "user:42", "Alice")
        let name = Redis.Get(r, "user:42")
        Console.WriteLine(name)

        Redis.Expire(r, "user:42", 3600)
        let visits = Redis.Incr(r, "visits")
        Console.WriteLine("visits: " + String_FromInt(visits))
        Redis.Close(r)
    }
}

At a glance

Related packages