-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
Context: some commands (example: FT.CURSOR READ
) in a cluster is only valid when used against the node that issued the command (see redis/NRedisStack#239).
Also: historically it has been kinda awkward to switch to IServer
.
Proposal:
- Add a new API to get a routed
IServer
fromIConnectionMultiplexer
:
IServer GetServer([RedisKey key], [CommandFlags flags]) // or GetServerForKey, or GetRoutedServer; naming is hard
semantics:
- if a key is provided on a clustered setup, we return a single-endpoint instance that matches the provided key (and flags, for primary/replica etc)
- otherwise, a single-endpoint instance (matching the flags, for primary/replica etc) is selected arbitrarily
- Add a database-aware
Execute
toIServer
:
RedisResult Execute(int? database, string command, params object[] args);
RedisResult Execute(int? database, string command, ICollection<object> args, CommandFlags flags = CommandFlags.None)
(and async twins)
semantics:
- database is always enabled in this usage, so
null
maps to howGetDatabase(-1)
works, i.e. "the default as specified on the options" - if you want to issue a non-db command, the existing API already allows that - parameter order is intentional to avoid ambiguity with the existing API