Skip to content

Commit

Permalink
Support latest ClientFlags (#1953)
Browse files Browse the repository at this point in the history
This adds the Redis 6.0+ flags from #1912
  • Loading branch information
NickCraver authored Jan 18, 2022
1 parent 745f75f commit 92fdfa3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/StackExchange.Redis/ClientInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public sealed class ClientInfo
/// S: the client is a normal replica server
/// U: the client is connected via a Unix domain socket
/// x: the client is in a MULTI/EXEC context
/// t: the client enabled keys tracking in order to perform client side caching
/// R: the client tracking target client is invalid
/// B: the client enabled broadcast tracking mode
/// </summary>
public string FlagsRaw { get; private set; }

Expand Down Expand Up @@ -173,6 +176,10 @@ internal static ClientInfo[] Parse(string input)
AddFlag(ref flags, value, ClientFlags.UnixDomainSocket, 'U');
AddFlag(ref flags, value, ClientFlags.Transaction, 'x');

AddFlag(ref flags, value, ClientFlags.KeysTracking, 't');
AddFlag(ref flags, value, ClientFlags.TrackingTargetInvalid, 'R');
AddFlag(ref flags, value, ClientFlags.BroadcastTracking, 'B');

client.Flags = flags;
break;
case "id": client.Id = Format.ParseInt64(value); break;
Expand Down
12 changes: 12 additions & 0 deletions src/StackExchange.Redis/Enums/ClientFlags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,17 @@ public enum ClientFlags : long
/// the client is connected via a Unix domain socket
/// </summary>
UnixDomainSocket = 2048,
/// <summary>
/// the client enabled keys tracking in order to perform client side caching
/// </summary>
KeysTracking = 4096,
/// <summary>
/// the client tracking target client is invalid
/// </summary>
TrackingTargetInvalid = 8192,
/// <summary>
/// the client enabled broadcast tracking mode
/// </summary>
BroadcastTracking = 16384,
}
}

0 comments on commit 92fdfa3

Please sign in to comment.