Fluent API for Redis endpoints.
// Key-value
.To(Redis.Set("user:123").Connection("redis-server:6379").Ttl(300))
.From(Redis.Subscribe("events.*").UsePattern())
// Streams
.From(Redis.XRead("order-stream").ConsumerGroup("workers").ConsumerName("w1"))
.To(Redis.XAdd("audit-stream").StreamMaxLength(10000))
// Generic operation
.To(Redis.Command("LPUSH", "task-queue"))
Methods
Any Redis operation by name.
public static RedisBuilder Command(string operation, string key)
DECR — decrement a key.
public static RedisBuilder Decr(string key)
DEL — delete a key.
public static RedisBuilder Del(string key)
EXISTS — check if key exists.
public static RedisBuilder Exists(string key)
EXPIRE — set TTL on a key.
public static RedisBuilder Expire(string key)
GET value by key.
public static RedisBuilder Get(string key)
INCR — increment a key.
public static RedisBuilder Incr(string key)
LLEN — get list length.
public static RedisBuilder LLen(string key)
LPOP — pop from head of list.
public static RedisBuilder LPop(string key)
LPUSH — push to head of list.
public static RedisBuilder LPush(string key)
LRANGE — get range from list.
public static RedisBuilder LRange(string key)
PSUBSCRIBE to a pattern (consumer).
public static RedisBuilder PSubscribe(string pattern)
PUBLISH messages to a channel.
public static RedisBuilder Publish(string channel)
RPOP — pop from tail of list.
public static RedisBuilder RPop(string key)
RPUSH — push to tail of list.
public static RedisBuilder RPush(string key)
SET key to a value.
public static RedisBuilder Set(string key)
SETNX — set value only if key does not exist.
public static RedisBuilder SetNx(string key)
SUBSCRIBE to a channel (consumer).
public static RedisBuilder Subscribe(string channel)
XADD — write to a stream.
public static RedisBuilder XAdd(string stream)
XGROUP — manage consumer groups.
public static RedisBuilder XGroup(string stream)
XREAD — read from a stream (consumer).
public static RedisBuilder XRead(string stream)