TRClientBase class abstract

The abstract base class for a Redis/Valkey client.

This interface defines the public API for interacting with a Redis/Valkey server. It covers core commands, key management, transactions, and Pub/Sub.

Implemented types
Implementers

Constructors

TRClientBase()

Properties

hashCode int
The hash code for this object.
no setterinherited
onConnected Future<void>
A Future that completes once the connection and authentication (if required) are successfully established.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() Future<void>
Closes the connection to the server.
clusterSlots() Future<List<ClusterSlotRange>>
Fetches the cluster topology information from the server.
connect({String? host, int? port, String? username, String? password}) Future<void>
Connects to the Redis/Valkey server.
decr(String key) Future<int>
Decrements the number stored at key by one.
inherited
decrBy(String key, int amount) Future<int>
Decrements the number stored at key by amount.
inherited
del(List<String> keys) Future<int>
Deletes the specified keys.
inherited
discard() Future<String>
Discards all commands queued after multi().
echo(String message) Future<String>
Echoes the given message back from the server.
inherited
exec() Future<List?>
Executes all commands queued after multi().
execute(List<String> command) Future
Executes a raw command.
exists(String key) Future<int>
Checks if key exists.
inherited
expire(String key, int seconds) Future<int>
Sets a timeout on key in seconds.
inherited
get(String key) Future<String?>
Gets the value of key.
inherited
hGet(String key, String field) Future
Gets the value of field in the hash stored at key.
inherited
hget(String key, String field) Future
inherited
hGetAll(String key) Future<Map<String, String>>
Gets all fields and values of the hash stored at key.
inherited
hgetall(String key) Future<Map<String, String>>
inherited
hSet(String key, Map<String, String> data) Future<int>
Sets field in the hash stored at key to value.
inherited
hset(String key, String field, String value) Future<int>
Sets multiple field-value pairs in the hash stored at key. Returns the number of fields that were added. Usage:
inherited
incr(String key) Future<int>
Increments the number stored at key by one.
inherited
incrBy(String key, int amount) Future<int>
Increments the number stored at key by amount.
inherited
lpop(String key) Future<String?>
Removes and returns the first element of the list stored at key.
inherited
lpush(String key, String value) Future<int>
Prepends value to the list stored at key.
inherited
lrange(String key, int start, int stop) Future<List<String?>>
Returns the specified elements of the list stored at key.
inherited
mget(List<String> keys) Future<List<String?>>
Gets the values of all specified keys.
inherited
multi() Future<String>
Marks the start of a transaction block.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ping([String? message]) Future<String>
PINGs the server.
psubscribe(List<String> patterns) Subscription
Subscribes the client to the given patterns (e.g., "log:*").
publish(String channel, String message) Future<int>
Posts a message to the given channel.
pubsubChannels([String? pattern]) Future<List<String?>>
Lists the currently active channels.
pubsubNumPat() Future<int>
Returns the number of subscriptions to patterns.
pubsubNumSub(List<String> channels) Future<Map<String, int>>
Returns the number of subscribers for the specified channels.
punsubscribe([List<String> patterns = const []]) Future<void>
Unsubscribes the client from the given patterns, or all patterns if none are given.
rpop(String key) Future<String?>
Removes and returns the last element of the list stored at key.
inherited
rpush(String key, String value) Future<int>
Appends value to the list stored at key.
inherited
sadd(String key, String member) Future<int>
Adds member to the set stored at key.
inherited
set(String key, String value, {bool nx = false, bool xx = false, bool get = false, int? ex, int? px, int? exAt, int? pxAt, bool keepTtl = false}) Future<String?>
Sets key to value.
inherited
smembers(String key) Future<List<String?>>
Returns all members of the set stored at key.
inherited
spublish(String channel, String message) Future<int>
Posts a message to the given channel using Sharded Pub/Sub. Returns the number of clients that received the message. Note: In Cluster mode, this command is routed to the specific node that owns the slot for channel.
inherited
srem(String key, String member) Future<int>
Removes member from the set stored at key.
inherited
ssubscribe(List<String> channels) Subscription
Subscribes the client to the specified channels using Sharded Pub/Sub.
inherited
subscribe(List<String> channels) Subscription
Subscribes the client to the specified channels.
sunsubscribe([List<String> channels = const []]) Future<void>
Unsubscribes from the given channels using Sharded Pub/Sub.
inherited
toString() String
A string representation of this object.
inherited
ttl(String key) Future<int>
Gets the remaining time to live of a key in seconds.
inherited
unsubscribe([List<String> channels = const []]) Future<void>
Unsubscribes the client from the given channels, or all channels if none are given.
zadd(String key, double score, String member) Future<int>
Adds member with the specified score to the sorted set stored at key.
inherited
zrange(String key, int start, int stop) Future<List<String?>>
Returns the specified range of members in the sorted set stored at key, ordered from lowest to highest score.
inherited
zrem(String key, String member) Future<int>
Removes member from the sorted set stored at key.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited