diff --git a/.editorconfig b/.editorconfig
index 6934b4a38..a00642936 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -138,23 +138,73 @@ csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
-# IDE0090: Use 'new(...)'
-dotnet_diagnostic.IDE0090.severity = silent
-# RCS1037: Remove trailing white-space.
-dotnet_diagnostic.RCS1037.severity = error
+# IDE preferences
+dotnet_diagnostic.IDE0090.severity = silent # IDE0090: Use 'new(...)'
+
+#Roslynator preferences
+dotnet_diagnostic.RCS1037.severity = error # RCS1037: Remove trailing white-space.
+dotnet_diagnostic.RCS1098.severity = none # RCS1098: Constant values should be placed on right side of comparisons.
+
+dotnet_diagnostic.RCS1194.severity = none # RCS1194: Implement exception constructors.
+dotnet_diagnostic.RCS1229.severity = none # RCS1229: Use async/await when necessary.
+dotnet_diagnostic.RCS1233.severity = none # RCS1233: Use short-circuiting operator.
+dotnet_diagnostic.RCS1234.severity = none # RCS1234: Duplicate enum value.
+
+# StyleCop preferences
+dotnet_diagnostic.SA0001.severity = none # SA0001: XML comment analysis is disabled
+
+dotnet_diagnostic.SA1101.severity = none # SA1101: Prefix local calls with this
+dotnet_diagnostic.SA1108.severity = none # SA1108: Block statements should not contain embedded comments
+dotnet_diagnostic.SA1122.severity = none # SA1122: Use string.Empty for empty strings
+dotnet_diagnostic.SA1127.severity = none # SA1127: Generic type constraints should be on their own line
+dotnet_diagnostic.SA1128.severity = none # SA1128: Put constructor initializers on their own line
+dotnet_diagnostic.SA1132.severity = none # SA1132: Do not combine fields
+dotnet_diagnostic.SA1133.severity = none # SA1133: Do not combine attributes
+
+dotnet_diagnostic.SA1200.severity = none # SA1200: Using directives should be placed correctly
+dotnet_diagnostic.SA1201.severity = none # SA1201: Elements should appear in the correct order
+dotnet_diagnostic.SA1202.severity = none # SA1202: Elements should be ordered by access
+dotnet_diagnostic.SA1203.severity = none # SA1203: Constants should appear before fields
+
+dotnet_diagnostic.SA1306.severity = none # SA1306: Field names should begin with lower-case letter
+dotnet_diagnostic.SA1309.severity = none # SA1309: Field names should not begin with underscore
+dotnet_diagnostic.SA1310.severity = silent # SA1310: Field names should not contain underscore
+dotnet_diagnostic.SA1311.severity = none # SA1311: Static readonly fields should begin with upper-case letter
+dotnet_diagnostic.SA1312.severity = none # SA1312: Variable names should begin with lower-case letter
+
+dotnet_diagnostic.SA1401.severity = silent # SA1401: Fields should be private
+dotnet_diagnostic.SA1402.severity = suggestion # SA1402: File may only contain a single type
+
+dotnet_diagnostic.SA1503.severity = silent # SA1503: Braces should not be omitted
+dotnet_diagnostic.SA1516.severity = silent # SA1516: Elements should be separated by blank line
+
+dotnet_diagnostic.SA1600.severity = none # SA1600: Elements should be documented
+dotnet_diagnostic.SA1601.severity = none # SA1601: Partial elements should be documented
+dotnet_diagnostic.SA1602.severity = none # SA1602: Enumeration items should be documented
+dotnet_diagnostic.SA1615.severity = none # SA1615: Element return value should be documented
+dotnet_diagnostic.SA1623.severity = none # SA1623: Property summary documentation should match accessors
+dotnet_diagnostic.SA1633.severity = none # SA1633: File should have header
+dotnet_diagnostic.SA1642.severity = none # SA1642: Constructor summary documentation should begin with standard text
+dotnet_diagnostic.SA1643.severity = none # SA1643: Destructor summary documentation should begin with standard text
+
+
+# To Fix:
+dotnet_diagnostic.SA1204.severity = none # SA1204: Static elements should appear before instance elements
+dotnet_diagnostic.SA1214.severity = none # SA1214: Readonly fields should appear before non-readonly fields
+dotnet_diagnostic.SA1304.severity = none # SA1304: Non-private readonly fields should begin with upper-case letter
+dotnet_diagnostic.SA1307.severity = none # SA1307: Accessible fields should begin with upper-case letter
+dotnet_diagnostic.SA1308.severity = suggestion # SA1308: Variable names should not be prefixed
+dotnet_diagnostic.SA1131.severity = none # SA1131: Use readable conditions
+dotnet_diagnostic.SA1405.severity = none # SA1405: Debug.Assert should provide message text
+dotnet_diagnostic.SA1501.severity = none # SA1501: Statement should not be on a single line
+dotnet_diagnostic.SA1502.severity = suggestion # SA1502: Element should not be on a single line
+dotnet_diagnostic.SA1513.severity = none # SA1513: Closing brace should be followed by blank line
+dotnet_diagnostic.SA1515.severity = none # SA1515: Single-line comment should be preceded by blank line
+dotnet_diagnostic.SA1611.severity = suggestion # SA1611: Element parameters should be documented
+dotnet_diagnostic.SA1649.severity = suggestion # SA1649: File name should match first type name
-# RCS1098: Constant values should be placed on right side of comparisons.
-dotnet_diagnostic.RCS1098.severity = none
-# RCS1194: Implement exception constructors.
-dotnet_diagnostic.RCS1194.severity = none
-# RCS1229: Use async/await when necessary.
-dotnet_diagnostic.RCS1229.severity = none
-# RCS1233: Use short-circuiting operator.
-dotnet_diagnostic.RCS1233.severity = none
-# RCS1234: Duplicate enum value.
-dotnet_diagnostic.RCS1234.severity = none
\ No newline at end of file
diff --git a/Directory.Build.props b/Directory.Build.props
index 43dd33169..ff720e26a 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -33,10 +33,13 @@
truetrue
+
+
+
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 9ef9afb25..49d37a3ae 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -20,6 +20,7 @@
+
diff --git a/src/StackExchange.Redis/APITypes/ClientKillFilter.cs b/src/StackExchange.Redis/APITypes/ClientKillFilter.cs
index b5c5e845c..3d1883549 100644
--- a/src/StackExchange.Redis/APITypes/ClientKillFilter.cs
+++ b/src/StackExchange.Redis/APITypes/ClientKillFilter.cs
@@ -113,7 +113,7 @@ public ClientKillFilter WithSkipMe(bool? skipMe)
///
/// Set the MaxAgeInSeconds filter.
///
- /// Age of connection in seconds
+ /// Age of connection in seconds.
public ClientKillFilter WithMaxAgeInSeconds(long? maxAgeInSeconds)
{
MaxAgeInSeconds = maxAgeInSeconds;
@@ -123,9 +123,9 @@ public ClientKillFilter WithMaxAgeInSeconds(long? maxAgeInSeconds)
internal List ToList(bool withReplicaCommands)
{
var parts = new List(15)
- {
- RedisLiterals.KILL
- };
+ {
+ RedisLiterals.KILL,
+ };
if (Id != null)
{
parts.Add(RedisLiterals.ID);
diff --git a/src/StackExchange.Redis/APITypes/GeoRadiusOptions.cs b/src/StackExchange.Redis/APITypes/GeoRadiusOptions.cs
index f9f182f5b..d21254fcd 100644
--- a/src/StackExchange.Redis/APITypes/GeoRadiusOptions.cs
+++ b/src/StackExchange.Redis/APITypes/GeoRadiusOptions.cs
@@ -13,22 +13,26 @@ public enum GeoRadiusOptions
/// No Options.
///
None = 0,
+
///
/// Redis will return the coordinates of any results.
///
WithCoordinates = 1,
+
///
/// Redis will return the distance from center for all results.
///
WithDistance = 2,
+
///
/// Redis will return the geo hash value as an integer. (This is the score in the sorted set).
///
WithGeoHash = 4,
+
///
/// Populates the commonly used values from the entry (the integer hash is not returned as it is not commonly useful).
///
- Default = WithCoordinates | WithDistance
+ Default = WithCoordinates | WithDistance,
}
internal static class GeoRadiusOptionsExtensions
diff --git a/src/StackExchange.Redis/APITypes/GeoRadiusResult.cs b/src/StackExchange.Redis/APITypes/GeoRadiusResult.cs
index d4cdbe8f8..952ca1625 100644
--- a/src/StackExchange.Redis/APITypes/GeoRadiusResult.cs
+++ b/src/StackExchange.Redis/APITypes/GeoRadiusResult.cs
@@ -23,7 +23,7 @@ public readonly struct GeoRadiusResult
///
/// The hash value of the matched member as an integer. (The key in the sorted set).
///
- /// Note that this is not the same as the hash returned from GeoHash
+ /// Note that this is not the same as the hash returned from GeoHash.
public long? Hash { get; }
///
diff --git a/src/StackExchange.Redis/APITypes/GeoSearchShape.cs b/src/StackExchange.Redis/APITypes/GeoSearchShape.cs
index 68f1ee754..7d85c3bfa 100644
--- a/src/StackExchange.Redis/APITypes/GeoSearchShape.cs
+++ b/src/StackExchange.Redis/APITypes/GeoSearchShape.cs
@@ -3,7 +3,7 @@
namespace StackExchange.Redis;
///
-/// A Shape that you can use for a GeoSearch
+/// A Shape that you can use for a GeoSearch.
///
public abstract class GeoSearchShape
{
@@ -18,9 +18,9 @@ public abstract class GeoSearchShape
internal abstract int ArgCount { get; }
///
- /// constructs a
+ /// constructs a .
///
- ///
+ /// The geography unit to use.
public GeoSearchShape(GeoUnit unit)
{
Unit = unit;
@@ -30,7 +30,7 @@ public GeoSearchShape(GeoUnit unit)
}
///
-/// A circle drawn on a map bounding
+/// A circle drawn on a map bounding.
///
public class GeoSearchCircle : GeoSearchShape
{
@@ -41,7 +41,7 @@ public class GeoSearchCircle : GeoSearchShape
///
/// The radius of the circle.
/// The distance unit the circle will use, defaults to Meters.
- public GeoSearchCircle(double radius, GeoUnit unit = GeoUnit.Meters) : base (unit)
+ public GeoSearchCircle(double radius, GeoUnit unit = GeoUnit.Meters) : base(unit)
{
_radius = radius;
}
@@ -49,9 +49,8 @@ public GeoSearchCircle(double radius, GeoUnit unit = GeoUnit.Meters) : base (uni
internal override int ArgCount => 3;
///
- /// Gets the s for this shape
+ /// Gets the s for this shape.
///
- ///
internal override void AddArgs(List args)
{
args.Add(RedisLiterals.BYRADIUS);
@@ -61,7 +60,7 @@ internal override void AddArgs(List args)
}
///
-/// A box drawn on a map
+/// A box drawn on a map.
///
public class GeoSearchBox : GeoSearchShape
{
diff --git a/src/StackExchange.Redis/APITypes/LatencyHistoryEntry.cs b/src/StackExchange.Redis/APITypes/LatencyHistoryEntry.cs
index 2303c6e49..003708e6a 100644
--- a/src/StackExchange.Redis/APITypes/LatencyHistoryEntry.cs
+++ b/src/StackExchange.Redis/APITypes/LatencyHistoryEntry.cs
@@ -3,7 +3,7 @@
namespace StackExchange.Redis;
///
-/// A latency entry as reported by the built-in LATENCY HISTORY command
+/// A latency entry as reported by the built-in LATENCY HISTORY command.
///
public readonly struct LatencyHistoryEntry
{
@@ -30,12 +30,12 @@ protected override bool TryParse(in RawResult raw, out LatencyHistoryEntry parse
}
///
- /// The time at which this entry was recorded
+ /// The time at which this entry was recorded.
///
public DateTime Timestamp { get; }
///
- /// The latency recorded for this event
+ /// The latency recorded for this event.
///
public int DurationMilliseconds { get; }
diff --git a/src/StackExchange.Redis/APITypes/LatencyLatestEntry.cs b/src/StackExchange.Redis/APITypes/LatencyLatestEntry.cs
index 67e416dc8..d1bc70e42 100644
--- a/src/StackExchange.Redis/APITypes/LatencyLatestEntry.cs
+++ b/src/StackExchange.Redis/APITypes/LatencyLatestEntry.cs
@@ -3,7 +3,7 @@
namespace StackExchange.Redis;
///
-/// A latency entry as reported by the built-in LATENCY LATEST command
+/// A latency entry as reported by the built-in LATENCY LATEST command.
///
public readonly struct LatencyLatestEntry
{
@@ -31,22 +31,22 @@ protected override bool TryParse(in RawResult raw, out LatencyLatestEntry parsed
}
///
- /// The name of this event
+ /// The name of this event.
///
public string EventName { get; }
///
- /// The time at which this entry was recorded
+ /// The time at which this entry was recorded.
///
public DateTime Timestamp { get; }
///
- /// The latency recorded for this event
+ /// The latency recorded for this event.
///
public int DurationMilliseconds { get; }
///
- /// The max latency recorded for all events
+ /// The max latency recorded for all events.
///
public int MaxDurationMilliseconds { get; }
diff --git a/src/StackExchange.Redis/APITypes/StreamPendingMessageInfo.cs b/src/StackExchange.Redis/APITypes/StreamPendingMessageInfo.cs
index 95f545ca5..32cbbcc8d 100644
--- a/src/StackExchange.Redis/APITypes/StreamPendingMessageInfo.cs
+++ b/src/StackExchange.Redis/APITypes/StreamPendingMessageInfo.cs
@@ -1,5 +1,4 @@
-
-namespace StackExchange.Redis;
+namespace StackExchange.Redis;
///
/// Describes properties of a pending message.
diff --git a/src/StackExchange.Redis/BufferReader.cs b/src/StackExchange.Redis/BufferReader.cs
index 5691217f9..22b36ccb6 100644
--- a/src/StackExchange.Redis/BufferReader.cs
+++ b/src/StackExchange.Redis/BufferReader.cs
@@ -41,7 +41,8 @@ private bool FetchNextSegment()
_current = _iterator.Current.Span;
OffsetThisSpan = 0;
RemainingThisSpan = _current.Length;
- } while (IsEmpty); // skip empty segments, they don't help us!
+ }
+ while (IsEmpty); // skip empty segments, they don't help us!
return true;
}
@@ -59,7 +60,7 @@ public BufferReader(scoped in ReadOnlySequence buffer)
}
///
- /// Note that in results other than success, no guarantees are made about final state; if you care: snapshot
+ /// Note that in results other than success, no guarantees are made about final state; if you care: snapshot.
///
public ConsumeResult TryConsumeCRLF()
{
@@ -82,6 +83,7 @@ public ConsumeResult TryConsumeCRLF()
return result;
}
}
+
public bool TryConsume(int count)
{
if (count < 0) throw new ArgumentOutOfRangeException(nameof(count));
@@ -102,7 +104,8 @@ public bool TryConsume(int count)
// consume all of this span
_totalConsumed += available;
count -= available;
- } while (FetchNextSegment());
+ }
+ while (FetchNextSegment());
return false;
}
@@ -127,13 +130,18 @@ public ReadOnlySequence ConsumeAsBuffer(int count)
if (!TryConsumeAsBuffer(count, out var buffer)) throw new EndOfStreamException();
return buffer;
}
+
public ReadOnlySequence ConsumeToEnd()
{
var from = SnapshotPosition();
var result = _buffer.Slice(from);
- while (FetchNextSegment()) { } // consume all
+ while (FetchNextSegment())
+ {
+ // consume all
+ }
return result;
}
+
public bool TryConsumeAsBuffer(int count, out ReadOnlySequence buffer)
{
var from = SnapshotPosition();
@@ -146,6 +154,7 @@ public bool TryConsumeAsBuffer(int count, out ReadOnlySequence buffer)
buffer = _buffer.Slice(from, to);
return true;
}
+
public void Consume(int count)
{
if (!TryConsume(count)) throw new EndOfStreamException();
@@ -163,13 +172,14 @@ public void Consume(int count)
if (found >= 0) return totalSkipped + found;
totalSkipped += span.Length;
- } while (reader.FetchNextSegment());
+ }
+ while (reader.FetchNextSegment());
return -1;
}
+
internal static int FindNextCrLf(BufferReader reader) // very deliberately not ref; want snapshot
{
// is it in the current span? (we need to handle the offsets differently if so)
-
int totalSkipped = 0;
bool haveTrailingCR = false;
do
diff --git a/src/StackExchange.Redis/ChannelMessageQueue.cs b/src/StackExchange.Redis/ChannelMessageQueue.cs
index 3bf7635f3..e58fb393b 100644
--- a/src/StackExchange.Redis/ChannelMessageQueue.cs
+++ b/src/StackExchange.Redis/ChannelMessageQueue.cs
@@ -52,12 +52,12 @@ internal ChannelMessage(ChannelMessageQueue queue, in RedisChannel channel, in R
public RedisValue Message { get; }
///
- /// Checks if 2 messages are .Equal()
+ /// Checks if 2 messages are .Equal().
///
public static bool operator ==(ChannelMessage left, ChannelMessage right) => left.Equals(right);
///
- /// Checks if 2 messages are not .Equal()
+ /// Checks if 2 messages are not .Equal().
///
public static bool operator !=(ChannelMessage left, ChannelMessage right) => !left.Equals(right);
}
@@ -72,6 +72,7 @@ internal ChannelMessage(ChannelMessageQueue queue, in RedisChannel channel, in R
public sealed class ChannelMessageQueue : IAsyncEnumerable
{
private readonly Channel _queue;
+
///
/// The Channel that was subscribed for this queue.
///
@@ -202,7 +203,8 @@ internal static void Combine(ref ChannelMessageQueue? head, ChannelMessageQueue
{
old = Volatile.Read(ref head);
queue._next = old;
- } while (Interlocked.CompareExchange(ref head, queue, old) != old);
+ }
+ while (Interlocked.CompareExchange(ref head, queue, old) != old);
}
}
@@ -226,7 +228,8 @@ internal static void Remove(ref ChannelMessageQueue? head, ChannelMessageQueue q
}
bool found;
- do // if we fail due to a conflict, re-do from start
+ // if we fail due to a conflict, re-do from start
+ do
{
var current = Volatile.Read(ref head);
if (current == null) return; // no queue? nothing to do
@@ -261,9 +264,11 @@ internal static void Remove(ref ChannelMessageQueue? head, ChannelMessageQueue q
}
previous = current;
current = Volatile.Read(ref previous!._next);
- } while (current != null);
+ }
+ while (current != null);
}
- } while (found);
+ }
+ while (found);
}
internal static int Count(ref ChannelMessageQueue? head)
diff --git a/src/StackExchange.Redis/ClientInfo.cs b/src/StackExchange.Redis/ClientInfo.cs
index 215403fe8..f04058495 100644
--- a/src/StackExchange.Redis/ClientInfo.cs
+++ b/src/StackExchange.Redis/ClientInfo.cs
@@ -156,7 +156,7 @@ public sealed class ClientInfo
///
/// A unique 64-bit client ID (introduced in Redis 2.8.12).
///
- public long Id { get;private set; }
+ public long Id { get; private set; }
///
/// Format the object as a string.
@@ -217,7 +217,7 @@ internal static bool TryParse(string? input, [NotNullWhen(true)] out ClientInfo[
{
var client = new ClientInfo
{
- Raw = line
+ Raw = line,
};
string[] tokens = line.Split(StringSplits.Space);
for (int i = 0; i < tokens.Length; i++)
@@ -285,7 +285,7 @@ private class ClientInfoProcessor : ResultProcessor
{
protected override bool SetResultCore(PhysicalConnection connection, Message message, in RawResult result)
{
- switch(result.Resp2TypeBulkString)
+ switch (result.Resp2TypeBulkString)
{
case ResultType.BulkString:
var raw = result.GetString();
diff --git a/src/StackExchange.Redis/ClusterConfiguration.cs b/src/StackExchange.Redis/ClusterConfiguration.cs
index 83ab19501..0ce256c95 100644
--- a/src/StackExchange.Redis/ClusterConfiguration.cs
+++ b/src/StackExchange.Redis/ClusterConfiguration.cs
@@ -247,7 +247,7 @@ internal ClusterNode? this[string nodeId]
/// The slot ID to get a node by.
public ClusterNode? GetBySlot(int slot)
{
- foreach(var node in Nodes)
+ foreach (var node in Nodes)
{
if (!node.IsReplica && node.ServesSlot(slot)) return node;
}
@@ -265,7 +265,7 @@ internal ClusterNode? this[string nodeId]
/// Represents the configuration of a single node in a cluster configuration.
///
///
- public sealed class ClusterNode : IEquatable, IComparable, IComparable
+ public sealed class ClusterNode : IEquatable, IComparable, IComparable
{
private readonly ClusterConfiguration configuration;
private IList? children;
@@ -421,7 +421,8 @@ public int CompareTo(ClusterNode? other)
if (IsReplica != other.IsReplica) return IsReplica ? 1 : -1; // primaries first
- if (IsReplica) // both replicas? compare by parent, so we get primaries A, B, C and then replicas of A, B, C
+ // both replicas? compare by parent, so we get primaries A, B, C and then replicas of A, B, C
+ if (IsReplica)
{
int i = string.CompareOrdinal(ParentNodeId, other.ParentNodeId);
if (i != 0) return i;
@@ -457,16 +458,16 @@ public override string ToString()
if (Parent is ClusterNode parent) sb.Append(" at ").Append(parent.EndPoint);
}
var childCount = Children.Count;
- switch(childCount)
+ switch (childCount)
{
case 0: break;
case 1: sb.Append(", 1 replica"); break;
default: sb.Append(", ").Append(childCount).Append(" replicas"); break;
}
- if(Slots.Count != 0)
+ if (Slots.Count != 0)
{
sb.Append(", slots: ");
- foreach(var slot in Slots)
+ foreach (var slot in Slots)
{
sb.Append(slot).Append(' ');
}
diff --git a/src/StackExchange.Redis/CommandBytes.cs b/src/StackExchange.Redis/CommandBytes.cs
index d9c96a3ab..19a69549b 100644
--- a/src/StackExchange.Redis/CommandBytes.cs
+++ b/src/StackExchange.Redis/CommandBytes.cs
@@ -54,7 +54,6 @@ public override int GetHashCode()
public bool Equals(in CommandBytes other) => _0 == other._0 && _1 == other._1 && _2 == other._2 && _3 == other._3;
// note: don't add == operators; with the implicit op above, that invalidates "==null" compiler checks (which should report a failure!)
-
public static implicit operator CommandBytes(string value) => new CommandBytes(value);
public override unsafe string ToString()
@@ -181,10 +180,16 @@ private static unsafe int UpperCasifyUnicode(int oldLen, byte* bPtr)
char* workspace = stackalloc char[MaxChars];
int charCount = Encoding.GetChars(bPtr, oldLen, workspace, MaxChars);
char* c = workspace;
- for (int i = 0; i < charCount; i++) *c = char.ToUpperInvariant(*c++);
+ for (int i = 0; i < charCount; i++)
+ {
+ *c = char.ToUpperInvariant(*c++);
+ }
int newLen = Encoding.GetBytes(workspace, charCount, bPtr, MaxLength);
// don't forget to zero any shrink
- for (int i = newLen; i < oldLen; i++) bPtr[i] = 0;
+ for (int i = newLen; i < oldLen; i++)
+ {
+ bPtr[i] = 0;
+ }
return newLen;
}
diff --git a/src/StackExchange.Redis/CommandMap.cs b/src/StackExchange.Redis/CommandMap.cs
index 0a42d3e34..67b6f1a9e 100644
--- a/src/StackExchange.Redis/CommandMap.cs
+++ b/src/StackExchange.Redis/CommandMap.cs
@@ -41,7 +41,7 @@ public sealed class CommandMap
RedisCommand.BGREWRITEAOF, RedisCommand.BGSAVE, RedisCommand.CLIENT, RedisCommand.CLUSTER, RedisCommand.CONFIG, RedisCommand.DBSIZE,
RedisCommand.DEBUG, RedisCommand.FLUSHALL, RedisCommand.FLUSHDB, RedisCommand.INFO, RedisCommand.LASTSAVE, RedisCommand.MONITOR, RedisCommand.REPLICAOF,
- RedisCommand.SAVE, RedisCommand.SHUTDOWN, RedisCommand.SLAVEOF, RedisCommand.SLOWLOG, RedisCommand.SYNC, RedisCommand.TIME
+ RedisCommand.SAVE, RedisCommand.SHUTDOWN, RedisCommand.SLAVEOF, RedisCommand.SLOWLOG, RedisCommand.SYNC, RedisCommand.TIME,
});
///
@@ -80,20 +80,27 @@ public sealed class CommandMap
/// The commands available to SSDB.
///
///
- public static CommandMap SSDB { get; } = Create(new HashSet {
- "ping",
- "get", "set", "del", "incr", "incrby", "mget", "mset", "keys", "getset", "setnx",
- "hget", "hset", "hdel", "hincrby", "hkeys", "hvals", "hmget", "hmset", "hlen",
- "zscore", "zadd", "zrem", "zrange", "zrangebyscore", "zincrby", "zdecrby", "zcard",
- "llen", "lpush", "rpush", "lpop", "rpop", "lrange", "lindex"
- }, true);
+ public static CommandMap SSDB { get; } = Create(
+ new HashSet
+ {
+ "ping",
+ "get", "set", "del", "incr", "incrby", "mget", "mset", "keys", "getset", "setnx",
+ "hget", "hset", "hdel", "hincrby", "hkeys", "hvals", "hmget", "hmset", "hlen",
+ "zscore", "zadd", "zrem", "zrange", "zrangebyscore", "zincrby", "zdecrby", "zcard",
+ "llen", "lpush", "rpush", "lpop", "rpop", "lrange", "lindex",
+ },
+ true);
///
/// The commands available to Sentinel.
///
///
- public static CommandMap Sentinel { get; } = Create(new HashSet {
- "auth", "hello", "ping", "info", "role", "sentinel", "subscribe", "shutdown", "psubscribe", "unsubscribe", "punsubscribe" }, true);
+ public static CommandMap Sentinel { get; } = Create(
+ new HashSet
+ {
+ "auth", "hello", "ping", "info", "role", "sentinel", "subscribe", "shutdown", "psubscribe", "unsubscribe", "punsubscribe",
+ },
+ true);
///
/// Create a new , customizing some commands.
@@ -195,8 +202,9 @@ internal void AssertAvailable(RedisCommand command)
internal CommandBytes GetBytes(string command)
{
if (command == null) return default;
- if(Enum.TryParse(command, true, out RedisCommand cmd))
- { // we know that one!
+ if (Enum.TryParse(command, true, out RedisCommand cmd))
+ {
+ // we know that one!
return map[(int)cmd];
}
return new CommandBytes(command);
diff --git a/src/StackExchange.Redis/CommandTrace.cs b/src/StackExchange.Redis/CommandTrace.cs
index 061f252b9..aedd05fea 100644
--- a/src/StackExchange.Redis/CommandTrace.cs
+++ b/src/StackExchange.Redis/CommandTrace.cs
@@ -14,7 +14,7 @@ internal CommandTrace(long uniqueId, long time, long duration, RedisValue[] argu
UniqueId = uniqueId;
Time = RedisBase.UnixEpoch.AddSeconds(time);
// duration = The amount of time needed for its execution, in microseconds.
- // A tick is equal to 100 nanoseconds, or one ten-millionth of a second.
+ // A tick is equal to 100 nanoseconds, or one ten-millionth of a second.
// So 1 microsecond = 10 ticks
Duration = TimeSpan.FromTicks(duration * 10);
Arguments = arguments;
@@ -42,7 +42,7 @@ internal CommandTrace(long uniqueId, long time, long duration, RedisValue[] argu
public long UniqueId { get; }
///
- /// Deduces a link to the redis documentation about the specified command
+ /// Deduces a link to the redis documentation about the specified command.
///
public string? GetHelpUrl()
{
@@ -73,18 +73,18 @@ private class CommandTraceProcessor : ResultProcessor
{
protected override bool SetResultCore(PhysicalConnection connection, Message message, in RawResult result)
{
- switch(result.Resp2TypeArray)
+ switch (result.Resp2TypeArray)
{
case ResultType.Array:
var parts = result.GetItems();
CommandTrace[] arr = new CommandTrace[parts.Length];
int i = 0;
- foreach(var item in parts)
+ foreach (var item in parts)
{
var subParts = item.GetItems();
if (!subParts[0].TryGetInt64(out long uniqueid) || !subParts[1].TryGetInt64(out long time) || !subParts[2].TryGetInt64(out long duration))
return false;
- arr[i++] = new CommandTrace(uniqueid, time, duration, subParts[3].GetItemsAsValues()!);
+ arr[i++] = new CommandTrace(uniqueid, time, duration, subParts[3].GetItemsAsValues()!);
}
SetResult(message, arr);
return true;
diff --git a/src/StackExchange.Redis/Condition.cs b/src/StackExchange.Redis/Condition.cs
index 0dcccf59c..308c87c11 100644
--- a/src/StackExchange.Redis/Condition.cs
+++ b/src/StackExchange.Redis/Condition.cs
@@ -483,7 +483,7 @@ internal override bool TryValidate(in RawResult result, out bool value)
{
case RedisType.SortedSet:
var parsedValue = result.AsRedisValue();
- value = (parsedValue.IsNull != expectedResult);
+ value = parsedValue.IsNull != expectedResult;
ConnectionMultiplexer.TraceWithoutContext("exists: " + parsedValue + "; expected: " + expectedResult + "; voting: " + value);
return true;
@@ -633,7 +633,7 @@ internal override bool TryValidate(in RawResult result, out bool value)
}
else
{
- value = (parsed.IsNull != expectedResult);
+ value = parsed.IsNull != expectedResult;
ConnectionMultiplexer.TraceWithoutContext("exists: " + parsed + "; expected: " + expectedResult + "; voting: " + value);
}
return true;
diff --git a/src/StackExchange.Redis/Configuration/AzureOptionsProvider.cs b/src/StackExchange.Redis/Configuration/AzureOptionsProvider.cs
index e66b0b210..6e38e15a9 100644
--- a/src/StackExchange.Redis/Configuration/AzureOptionsProvider.cs
+++ b/src/StackExchange.Redis/Configuration/AzureOptionsProvider.cs
@@ -1,7 +1,7 @@
-using StackExchange.Redis.Maintenance;
-using System;
+using System;
using System.Net;
using System.Threading.Tasks;
+using StackExchange.Redis.Maintenance;
namespace StackExchange.Redis.Configuration
{
diff --git a/src/StackExchange.Redis/Configuration/DefaultOptionsProvider.cs b/src/StackExchange.Redis/Configuration/DefaultOptionsProvider.cs
index 359b5f5f6..703adbcac 100644
--- a/src/StackExchange.Redis/Configuration/DefaultOptionsProvider.cs
+++ b/src/StackExchange.Redis/Configuration/DefaultOptionsProvider.cs
@@ -31,7 +31,7 @@ public class DefaultOptionsProvider
///
/// The current list of providers to match (potentially modified from defaults via .
///
- private static LinkedList KnownProviders { get; set; } = new (BuiltInProviders);
+ private static LinkedList KnownProviders { get; set; } = new(BuiltInProviders);
///
/// Adds a provider to match endpoints against. The last provider added has the highest priority.
@@ -143,9 +143,9 @@ public static DefaultOptionsProvider GetProvider(EndPoint endpoint)
///
/// Controls how often the connection heartbeats. A heartbeat includes:
- /// - Evaluating if any messages have timed out
- /// - Evaluating connection status (checking for failures)
- /// - Sending a server message to keep the connection alive if needed
+ /// - Evaluating if any messages have timed out.
+ /// - Evaluating connection status (checking for failures).
+ /// - Sending a server message to keep the connection alive if needed.
///
/// Be aware setting this very low incurs additional overhead of evaluating the above more often.
public virtual TimeSpan HeartbeatInterval => TimeSpan.FromSeconds(1);
@@ -157,12 +157,12 @@ public static DefaultOptionsProvider GetProvider(EndPoint endpoint)
public virtual bool HeartbeatConsistencyChecks => false;
///
- /// Should exceptions include identifiable details? (key names, additional .Data annotations)
+ /// Whether exceptions include identifiable details (key names, additional .Data annotations).
///
public virtual bool IncludeDetailInExceptions => true;
///
- /// Should exceptions include performance counter details?
+ /// Whether exceptions include performance counter details.
///
///
/// CPU usage, etc - note that this can be problematic on some platforms.
@@ -223,6 +223,7 @@ public static DefaultOptionsProvider GetProvider(EndPoint endpoint)
// We memoize this to reduce cost on re-access
private string? defaultClientName;
+
///
/// The default client name for a connection, with the library version appended.
///
@@ -253,7 +254,7 @@ protected virtual string GetDefaultClientName() =>
protected static string ComputerName => Environment.MachineName ?? Environment.GetEnvironmentVariable("ComputerName") ?? "Unknown";
///
- /// Whether to identify the client by library name/version when possible
+ /// Whether to identify the client by library name/version when possible.
///
public virtual bool SetClientLibrary => true;
@@ -293,7 +294,7 @@ protected virtual string GetDefaultClientName() =>
}
catch (Exception)
{
- //silently ignores the exception
+ // Silently ignores the exception
roleInstanceId = null;
}
return roleInstanceId;
diff --git a/src/StackExchange.Redis/Configuration/LoggingTunnel.cs b/src/StackExchange.Redis/Configuration/LoggingTunnel.cs
index a30dedf85..987d2075c 100644
--- a/src/StackExchange.Redis/Configuration/LoggingTunnel.cs
+++ b/src/StackExchange.Redis/Configuration/LoggingTunnel.cs
@@ -1,6 +1,4 @@
-using Pipelines.Sockets.Unofficial;
-using Pipelines.Sockets.Unofficial.Arenas;
-using System;
+using System;
using System.Buffers;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
@@ -12,12 +10,14 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using Pipelines.Sockets.Unofficial;
+using Pipelines.Sockets.Unofficial.Arenas;
using static StackExchange.Redis.PhysicalConnection;
namespace StackExchange.Redis.Configuration;
///
-/// Captures redis traffic; intended for debug use
+/// Captures redis traffic; intended for debug use.
///
[Obsolete("This API is experimental, has security and performance implications, and may change without notice", false)]
[SuppressMessage("ApiDesign", "RS0016:Add public types and members to the declared API", Justification = "Experimental API")]
@@ -28,7 +28,7 @@ public abstract class LoggingTunnel : Tunnel
private readonly Tunnel? _tail;
///
- /// Replay the RESP messages for a pair of streams, invoking a callback per operation
+ /// Replay the RESP messages for a pair of streams, invoking a callback per operation.
///
public static async Task ReplayAsync(Stream @out, Stream @in, Action pair)
{
@@ -51,7 +51,8 @@ public static async Task ReplayAsync(Stream @out, Stream @in, Action ReplayAsync(Stream @out, Stream @in, Action
- /// Replay the RESP messages all the streams in a folder, invoking a callback per operation
+ /// Replay the RESP messages all the streams in a folder, invoking a callback per operation.
///
/// The directory of captured files to replay.
/// Operation to perform per replayed message pair.
@@ -249,15 +249,14 @@ private static ContextualRedisResult ProcessBuffer(Arena arena, ref R
static bool IsArrayOutOfBand(in RawResult result)
{
var items = result.GetItems();
- return (items.Length >= 3 && items[0].IsEqual(message) || items[0].IsEqual(smessage))
+ return (items.Length >= 3 && (items[0].IsEqual(message) || items[0].IsEqual(smessage)))
|| (items.Length >= 4 && items[0].IsEqual(pmessage));
-
}
}
private static readonly CommandBytes message = "message", pmessage = "pmessage", smessage = "smessage";
///
- /// Create a new instance of a
+ /// Create a new instance of a .
///
protected LoggingTunnel(ConfigurationOptions? options = null, Tunnel? tail = null)
{
@@ -324,7 +323,7 @@ protected override Stream Log(Stream stream, EndPoint endpoint, ConnectionType c
}
///
- /// Perform logging on the provided stream
+ /// Perform logging on the provided stream.
///
protected abstract Stream Log(Stream stream, EndPoint endpoint, ConnectionType connectionType);
@@ -353,10 +352,12 @@ private async Task TlsHandshakeAsync(Stream stream, EndPoint endpoint)
host = Format.ToStringHostOnly(endpoint);
}
- var ssl = new SslStream(stream, false,
- _options.CertificateValidationCallback ?? PhysicalConnection.GetAmbientIssuerCertificateCallback(),
- _options.CertificateSelectionCallback ?? PhysicalConnection.GetAmbientClientCertificateCallback(),
- EncryptionPolicy.RequireEncryption);
+ var ssl = new SslStream(
+ innerStream: stream,
+ leaveInnerStreamOpen: false,
+ userCertificateValidationCallback: _options.CertificateValidationCallback ?? PhysicalConnection.GetAmbientIssuerCertificateCallback(),
+ userCertificateSelectionCallback: _options.CertificateSelectionCallback ?? PhysicalConnection.GetAmbientClientCertificateCallback(),
+ encryptionPolicy: EncryptionPolicy.RequireEncryption);
#if NETCOREAPP3_1_OR_GREATER
var configOptions = _options.SslClientAuthenticationOptions?.Invoke(host);
@@ -375,7 +376,7 @@ private async Task TlsHandshakeAsync(Stream stream, EndPoint endpoint)
}
///
- /// Get a typical text representation of a redis command
+ /// Get a typical text representation of a redis command.
///
public static string DefaultFormatCommand(RedisResult value)
{
@@ -402,7 +403,7 @@ public static string DefaultFormatCommand(RedisResult value)
return sb.ToString();
}
}
- catch {}
+ catch { }
return value.Type.ToString();
static bool IsSimple(RedisResult value)
@@ -433,7 +434,7 @@ static bool IsSimple(RedisResult value)
}
///
- /// Get a typical text representation of a redis response
+ /// Get a typical text representation of a redis response.
///
public static string DefaultFormatResponse(RedisResult value)
{
diff --git a/src/StackExchange.Redis/Configuration/Tunnel.cs b/src/StackExchange.Redis/Configuration/Tunnel.cs
index 15c9abd15..beebff2dc 100644
--- a/src/StackExchange.Redis/Configuration/Tunnel.cs
+++ b/src/StackExchange.Redis/Configuration/Tunnel.cs
@@ -52,8 +52,7 @@ private sealed class HttpProxyTunnel : Tunnel
const string Prefix = "CONNECT ", Suffix = " HTTP/1.1\r\n\r\n", ExpectedResponse1 = "HTTP/1.1 200 OK\r\n\r\n", ExpectedResponse2 = "HTTP/1.1 200 Connection established\r\n\r\n";
byte[] chunk = ArrayPool.Shared.Rent(Math.Max(
encoding.GetByteCount(Prefix) + encoding.GetByteCount(ep) + encoding.GetByteCount(Suffix),
- Math.Max(encoding.GetByteCount(ExpectedResponse1), encoding.GetByteCount(ExpectedResponse2))
- ));
+ Math.Max(encoding.GetByteCount(ExpectedResponse1), encoding.GetByteCount(ExpectedResponse2))));
var offset = 0;
offset += encoding.GetBytes(Prefix, 0, Prefix.Length, chunk, offset);
offset += encoding.GetBytes(ep, 0, ep.Length, chunk, offset);
diff --git a/src/StackExchange.Redis/ConfigurationOptions.cs b/src/StackExchange.Redis/ConfigurationOptions.cs
index 4f3ff1287..e972962b2 100644
--- a/src/StackExchange.Redis/ConfigurationOptions.cs
+++ b/src/StackExchange.Redis/ConfigurationOptions.cs
@@ -63,7 +63,7 @@ internal static Proxy ParseProxy(string key, string value)
internal static SslProtocols ParseSslProtocols(string key, string? value)
{
- //Flags expect commas as separators, but we need to use '|' since commas are already used in the connection string to mean something else
+ // Flags expect commas as separators, but we need to use '|' since commas are already used in the connection string to mean something else
value = value?.Replace("|", ",");
if (!Enum.TryParse(value, true, out SslProtocols tmp)) throw new ArgumentOutOfRangeException(key, $"Keyword '{key}' requires an SslProtocol value (multiple values separated by '|'); the value '{value}' is not recognised.");
@@ -182,14 +182,14 @@ public static string TryNormalize(string value)
/// A LocalCertificateSelectionCallback delegate responsible for selecting the certificate used for authentication; note
/// that this cannot be specified in the configuration-string.
///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly", Justification = "Existing compatibility")]
public event LocalCertificateSelectionCallback? CertificateSelection;
///
/// A RemoteCertificateValidationCallback delegate responsible for validating the certificate supplied by the remote party; note
/// that this cannot be specified in the configuration-string.
///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly", Justification = "Existing compatibility")]
public event RemoteCertificateValidationCallback? CertificateValidation;
///
@@ -238,7 +238,7 @@ public int AsyncTimeout
}
///
- /// Indicates whether the connection should be encrypted
+ /// Indicates whether the connection should be encrypted.
///
[Obsolete("Please use .Ssl instead of .UseSsl, will be removed in 3.0."),
Browsable(false),
@@ -258,7 +258,6 @@ public bool SetClientLibrary
set => setClientLibrary = value;
}
-
///
/// Gets or sets the library name to use for CLIENT SETINFO lib-name calls to Redis during handshake.
/// Defaults to "SE.Redis".
@@ -477,9 +476,9 @@ public bool HeartbeatConsistencyChecks
///
/// Controls how often the connection heartbeats. A heartbeat includes:
- /// - Evaluating if any messages have timed out
- /// - Evaluating connection status (checking for failures)
- /// - Sending a server message to keep the connection alive if needed
+ /// - Evaluating if any messages have timed out.
+ /// - Evaluating connection status (checking for failures).
+ /// - Sending a server message to keep the connection alive if needed.
///
///
/// This defaults to 1000 milliseconds and should not be changed for most use cases.
@@ -506,7 +505,7 @@ public bool HighPrioritySocketThreads
}
///
- /// Should exceptions include identifiable details? (key names, additional .Data annotations)
+ /// Whether exceptions include identifiable details (key names, additional .Data annotations).
///
public bool IncludeDetailInExceptions
{
@@ -515,7 +514,7 @@ public bool IncludeDetailInExceptions
}
///
- /// Should exceptions include performance counter details?
+ /// Whether exceptions include performance counter details.
///
///
/// CPU usage, etc - note that this can be problematic on some platforms.
@@ -528,7 +527,7 @@ public bool IncludePerformanceCountersInExceptions
///
/// Specifies the time in seconds at which connections should be pinged to ensure validity.
- /// -1 Defaults to 60 Seconds
+ /// -1 Defaults to 60 Seconds.
///
public int KeepAlive
{
@@ -1107,7 +1106,7 @@ private ConfigurationOptions DoParse(string configuration, bool ignoreUnknown)
public Tunnel? Tunnel { get; set; }
///
- /// Specify the redis protocol type
+ /// Specify the redis protocol type.
///
public RedisProtocol? Protocol { get; set; }
@@ -1115,12 +1114,12 @@ internal bool TryResp3()
{
// note: deliberately leaving the IsAvailable duplicated to use short-circuit
- //if (Protocol is null)
- //{
- // // if not specified, lean on the server version and whether HELLO is available
- // return new RedisFeatures(DefaultVersion).Resp3 && CommandMap.IsAvailable(RedisCommand.HELLO);
- //}
- //else
+ // if (Protocol is null)
+ // {
+ // // if not specified, lean on the server version and whether HELLO is available
+ // return new RedisFeatures(DefaultVersion).Resp3 && CommandMap.IsAvailable(RedisCommand.HELLO);
+ // }
+ // else
// ^^^ left for context; originally our intention was to auto-enable RESP3 by default *if* the server version
// is >= 6; however, it turns out (see extensive conversation here https://github.com/StackExchange/StackExchange.Redis/pull/2396)
// that tangential undocumented API breaks were made at the same time; this means that even if we fix every
diff --git a/src/StackExchange.Redis/ConnectionCounters.cs b/src/StackExchange.Redis/ConnectionCounters.cs
index 5be2ae488..546e2eff5 100644
--- a/src/StackExchange.Redis/ConnectionCounters.cs
+++ b/src/StackExchange.Redis/ConnectionCounters.cs
@@ -71,7 +71,7 @@ internal ConnectionCounters(ConnectionType connectionType)
///
/// The number of subscriptions (with and without patterns) currently held against this connection.
///
- public long Subscriptions { get;internal set; }
+ public long Subscriptions { get; internal set; }
///
/// Indicates the total number of outstanding items against this connection.
diff --git a/src/StackExchange.Redis/ConnectionFailedEventArgs.cs b/src/StackExchange.Redis/ConnectionFailedEventArgs.cs
index 01f9ff408..5d165add1 100644
--- a/src/StackExchange.Redis/ConnectionFailedEventArgs.cs
+++ b/src/StackExchange.Redis/ConnectionFailedEventArgs.cs
@@ -32,7 +32,7 @@ internal ConnectionFailedEventArgs(EventHandler? hand
/// The exception that occurred.
/// Connection physical name.
public ConnectionFailedEventArgs(object sender, EndPoint endPoint, ConnectionType connectionType, ConnectionFailureType failureType, Exception exception, string physicalName)
- : this (null, sender, endPoint, connectionType, failureType, exception, physicalName)
+ : this(null, sender, endPoint, connectionType, failureType, exception, physicalName)
{
}
diff --git a/src/StackExchange.Redis/ConnectionMultiplexer.ExportConfiguration.cs b/src/StackExchange.Redis/ConnectionMultiplexer.ExportConfiguration.cs
index 55c8deefb..c095ffd53 100644
--- a/src/StackExchange.Redis/ConnectionMultiplexer.ExportConfiguration.cs
+++ b/src/StackExchange.Redis/ConnectionMultiplexer.ExportConfiguration.cs
@@ -98,7 +98,7 @@ public void ExportConfiguration(Stream destination, ExportOptions options = Expo
}
}
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times", Justification = "We're not double disposing.")]
private static void Write(ZipArchive zip, string name, Task task, Action callback)
{
var entry = zip.CreateEntry(name, CompressionLevel.Optimal);
diff --git a/src/StackExchange.Redis/ConnectionMultiplexer.FeatureFlags.cs b/src/StackExchange.Redis/ConnectionMultiplexer.FeatureFlags.cs
index a6c2168f6..975da5de1 100644
--- a/src/StackExchange.Redis/ConnectionMultiplexer.FeatureFlags.cs
+++ b/src/StackExchange.Redis/ConnectionMultiplexer.FeatureFlags.cs
@@ -19,7 +19,8 @@ private static void SetAutodetectFeatureFlags()
{
bool value = false;
try
- { // attempt to detect a known problem scenario
+ {
+ // attempt to detect a known problem scenario
value = SynchronizationContext.Current?.GetType()?.Name
== "LegacyAspNetSynchronizationContext";
}
diff --git a/src/StackExchange.Redis/ConnectionMultiplexer.Profiling.cs b/src/StackExchange.Redis/ConnectionMultiplexer.Profiling.cs
index b6ecbdf3f..c60966234 100644
--- a/src/StackExchange.Redis/ConnectionMultiplexer.Profiling.cs
+++ b/src/StackExchange.Redis/ConnectionMultiplexer.Profiling.cs
@@ -10,7 +10,7 @@ public partial class ConnectionMultiplexer
///
/// Register a callback to provide an on-demand ambient session provider based on the
/// calling context; the implementing code is responsible for reliably resolving the same provider
- /// based on ambient context, or returning null to not profile
+ /// based on ambient context, or returning null to not profile.
///
/// The session provider to register.
public void RegisterProfiler(Func profilingSessionProvider) => _profilingSessionProvider = profilingSessionProvider;
diff --git a/src/StackExchange.Redis/ConnectionMultiplexer.Sentinel.cs b/src/StackExchange.Redis/ConnectionMultiplexer.Sentinel.cs
index 238c32bda..7753954d0 100644
--- a/src/StackExchange.Redis/ConnectionMultiplexer.Sentinel.cs
+++ b/src/StackExchange.Redis/ConnectionMultiplexer.Sentinel.cs
@@ -1,12 +1,12 @@
-using Microsoft.Extensions.Logging;
-using Pipelines.Sockets.Unofficial;
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
+using Pipelines.Sockets.Unofficial;
namespace StackExchange.Redis;
@@ -33,33 +33,36 @@ internal void InitializeSentinel(ILogger? log)
if (sub.SubscribedEndpoint(RedisChannel.Literal("+switch-master")) == null)
{
- sub.Subscribe(RedisChannel.Literal("+switch-master"), (__, message) =>
- {
- string[] messageParts = ((string)message!).Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
- // We don't care about the result of this - we're just trying
- _ = Format.TryParseEndPoint(string.Format("{0}:{1}", messageParts[1], messageParts[2]), out var switchBlame);
-
- lock (sentinelConnectionChildren)
+ sub.Subscribe(
+ RedisChannel.Literal("+switch-master"),
+ (__, message) =>
{
- // Switch the primary if we have connections for that service
- if (sentinelConnectionChildren.ContainsKey(messageParts[0]))
- {
- ConnectionMultiplexer child = sentinelConnectionChildren[messageParts[0]];
+ string[] messageParts = ((string)message!).Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
+ // We don't care about the result of this - we're just trying
+ _ = Format.TryParseEndPoint(string.Format("{0}:{1}", messageParts[1], messageParts[2]), out var switchBlame);
- // Is the connection still valid?
- if (child.IsDisposed)
- {
- child.ConnectionFailed -= OnManagedConnectionFailed;
- child.ConnectionRestored -= OnManagedConnectionRestored;
- sentinelConnectionChildren.Remove(messageParts[0]);
- }
- else
+ lock (sentinelConnectionChildren)
+ {
+ // Switch the primary if we have connections for that service
+ if (sentinelConnectionChildren.ContainsKey(messageParts[0]))
{
- SwitchPrimary(switchBlame, sentinelConnectionChildren[messageParts[0]]);
+ ConnectionMultiplexer child = sentinelConnectionChildren[messageParts[0]];
+
+ // Is the connection still valid?
+ if (child.IsDisposed)
+ {
+ child.ConnectionFailed -= OnManagedConnectionFailed;
+ child.ConnectionRestored -= OnManagedConnectionRestored;
+ sentinelConnectionChildren.Remove(messageParts[0]);
+ }
+ else
+ {
+ SwitchPrimary(switchBlame, sentinelConnectionChildren[messageParts[0]]);
+ }
}
}
- }
- }, CommandFlags.FireAndForget);
+ },
+ CommandFlags.FireAndForget);
}
// If we lose connection to a sentinel server,
@@ -71,11 +74,14 @@ internal void InitializeSentinel(ILogger? log)
// Subscribe to new sentinels being added
if (sub.SubscribedEndpoint(RedisChannel.Literal("+sentinel")) == null)
{
- sub.Subscribe(RedisChannel.Literal("+sentinel"), (_, message) =>
- {
- string[] messageParts = ((string)message!).Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
- UpdateSentinelAddressList(messageParts[0]);
- }, CommandFlags.FireAndForget);
+ sub.Subscribe(
+ RedisChannel.Literal("+sentinel"),
+ (_, message) =>
+ {
+ string[] messageParts = ((string)message!).Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
+ UpdateSentinelAddressList(messageParts[0]);
+ },
+ CommandFlags.FireAndForget);
}
}
@@ -164,7 +170,8 @@ public ConnectionMultiplexer GetSentinelMasterConnection(ConfigurationOptions co
{
if (ServerSelectionStrategy.ServerType != ServerType.Sentinel)
{
- throw new RedisConnectionException(ConnectionFailureType.UnableToConnect,
+ throw new RedisConnectionException(
+ ConnectionFailureType.UnableToConnect,
"Sentinel: The ConnectionMultiplexer is not a Sentinel connection. Detected as: " + ServerSelectionStrategy.ServerType);
}
@@ -198,7 +205,8 @@ public ConnectionMultiplexer GetSentinelMasterConnection(ConfigurationOptions co
if (newPrimaryEndPoint is null)
{
- throw new RedisConnectionException(ConnectionFailureType.UnableToConnect,
+ throw new RedisConnectionException(
+ ConnectionFailureType.UnableToConnect,
$"Sentinel: Failed connecting to configured primary for service: {config.ServiceName}");
}
@@ -241,11 +249,13 @@ public ConnectionMultiplexer GetSentinelMasterConnection(ConfigurationOptions co
}
Thread.Sleep(100);
- } while (sw.ElapsedMilliseconds < config.ConnectTimeout);
+ }
+ while (sw.ElapsedMilliseconds < config.ConnectTimeout);
if (!success)
{
- throw new RedisConnectionException(ConnectionFailureType.UnableToConnect,
+ throw new RedisConnectionException(
+ ConnectionFailureType.UnableToConnect,
$"Sentinel: Failed connecting to configured primary for service: {config.ServiceName}");
}
@@ -323,29 +333,33 @@ internal void OnManagedConnectionFailed(object? sender, ConnectionFailedEventArg
// or if we miss the published primary change.
if (connection.sentinelPrimaryReconnectTimer == null)
{
- connection.sentinelPrimaryReconnectTimer = new Timer(_ =>
- {
- try
- {
- // Attempt, but do not fail here
- SwitchPrimary(e.EndPoint, connection);
- }
- catch (Exception)
- {
- }
- finally
+ connection.sentinelPrimaryReconnectTimer = new Timer(
+ _ =>
{
try
{
- connection.sentinelPrimaryReconnectTimer?.Change(TimeSpan.FromSeconds(1), Timeout.InfiniteTimeSpan);
+ // Attempt, but do not fail here
+ SwitchPrimary(e.EndPoint, connection);
}
- catch (ObjectDisposedException)
+ catch (Exception)
{
- // If we get here the managed connection was restored and the timer was
- // disposed by another thread, so there's no need to run the timer again.
}
- }
- }, null, TimeSpan.Zero, Timeout.InfiniteTimeSpan);
+ finally
+ {
+ try
+ {
+ connection.sentinelPrimaryReconnectTimer?.Change(TimeSpan.FromSeconds(1), Timeout.InfiniteTimeSpan);
+ }
+ catch (ObjectDisposedException)
+ {
+ // If we get here the managed connection was restored and the timer was
+ // disposed by another thread, so there's no need to run the timer again.
+ }
+ }
+ },
+ null,
+ TimeSpan.Zero,
+ Timeout.InfiniteTimeSpan);
}
}
@@ -389,8 +403,7 @@ internal void SwitchPrimary(EndPoint? switchBlame, ConnectionMultiplexer connect
// Get new primary - try twice
EndPoint newPrimaryEndPoint = GetConfiguredPrimaryForService(serviceName)
?? GetConfiguredPrimaryForService(serviceName)
- ?? throw new RedisConnectionException(ConnectionFailureType.UnableToConnect,
- $"Sentinel: Failed connecting to switch primary for service: {serviceName}");
+ ?? throw new RedisConnectionException(ConnectionFailureType.UnableToConnect, $"Sentinel: Failed connecting to switch primary for service: {serviceName}");
connection.currentSentinelPrimaryEndPoint = newPrimaryEndPoint;
@@ -411,8 +424,14 @@ internal void SwitchPrimary(EndPoint? switchBlame, ConnectionMultiplexer connect
}
Trace($"Switching primary to {newPrimaryEndPoint}");
// Trigger a reconfigure
- connection.ReconfigureAsync(first: false, reconfigureAll: false, logger, switchBlame,
- $"Primary switch {serviceName}", false, CommandFlags.PreferMaster).Wait();
+ connection.ReconfigureAsync(
+ first: false,
+ reconfigureAll: false,
+ log: logger,
+ blame: switchBlame,
+ cause: $"Primary switch {serviceName}",
+ publishReconfigure: false,
+ publishReconfigureFlags: CommandFlags.PreferMaster).Wait();
UpdateSentinelAddressList(serviceName);
}
diff --git a/src/StackExchange.Redis/ConnectionMultiplexer.StormLog.cs b/src/StackExchange.Redis/ConnectionMultiplexer.StormLog.cs
index a32687b5d..51c62d00e 100644
--- a/src/StackExchange.Redis/ConnectionMultiplexer.StormLog.cs
+++ b/src/StackExchange.Redis/ConnectionMultiplexer.StormLog.cs
@@ -6,6 +6,7 @@ public partial class ConnectionMultiplexer
{
internal int haveStormLog = 0;
internal string? stormLogSnapshot;
+
///
/// Limit at which to start recording unusual busy patterns (only one log will be retained at a time).
/// Set to a negative value to disable this feature.
diff --git a/src/StackExchange.Redis/ConnectionMultiplexer.cs b/src/StackExchange.Redis/ConnectionMultiplexer.cs
index 022ae8cd9..8a4b8733d 100644
--- a/src/StackExchange.Redis/ConnectionMultiplexer.cs
+++ b/src/StackExchange.Redis/ConnectionMultiplexer.cs
@@ -1,7 +1,4 @@
-using Microsoft.Extensions.Logging;
-using Pipelines.Sockets.Unofficial;
-using StackExchange.Redis.Profiling;
-using System;
+using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
@@ -14,6 +11,9 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
+using Pipelines.Sockets.Unofficial;
+using StackExchange.Redis.Profiling;
namespace StackExchange.Redis
{
@@ -70,9 +70,7 @@ pulse is null
internal static long LastGlobalHeartbeatSecondsAgo =>
unchecked(Environment.TickCount - Thread.VolatileRead(ref lastGlobalHeartbeatTicks)) / 1000;
- ///
- /// Should exceptions include identifiable details? (key names, additional .Data annotations)
- ///
+ ///
[Obsolete($"Please use {nameof(ConfigurationOptions)}.{nameof(ConfigurationOptions.IncludeDetailInExceptions)} instead - this will be removed in 3.0.")]
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public bool IncludeDetailInExceptions
@@ -81,12 +79,7 @@ public bool IncludeDetailInExceptions
set => RawConfig.IncludeDetailInExceptions = value;
}
- ///
- /// Should exceptions include performance counter details?
- ///
- ///
- /// CPU usage, etc - note that this can be problematic on some platforms.
- ///
+ ///
[Obsolete($"Please use {nameof(ConfigurationOptions)}.{nameof(ConfigurationOptions.IncludePerformanceCountersInExceptions)} instead - this will be removed in 3.0.")]
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
public bool IncludePerformanceCountersInExceptions
@@ -858,7 +851,7 @@ public bool Any(Func? predicate = null)
public ServerSnapshotFiltered Where(CommandFlags flags)
{
var effectiveFlags = flags & (CommandFlags.DemandMaster | CommandFlags.DemandReplica);
- return (effectiveFlags) switch
+ return effectiveFlags switch
{
CommandFlags.DemandMaster => Where(static s => !s.IsReplica),
CommandFlags.DemandReplica => Where(static s => s.IsReplica),
@@ -1021,7 +1014,6 @@ public void Dispose()
// outstanding messages; if the consumer has dropped the multiplexer, then
// there will be no new incoming messages, and after timeouts: everything
// should drop.
-
public void Root(ConnectionMultiplexer multiplexer)
{
lock (StrongRefSyncLock)
@@ -1074,7 +1066,8 @@ private void OnHeartbeat()
}
}
if (isRooted && !hasPendingCallerFacingItems)
- { // release the GC root on the heartbeat *if* the token still matches
+ {
+ // release the GC root on the heartbeat *if* the token still matches
pulse?.UnRoot(token);
}
}
@@ -1483,7 +1476,7 @@ internal async Task ReconfigureAsync(bool first, bool reconfigureAll, ILog
Trace("Testing: " + Format.ToString(endpoints[i]));
var server = GetServerEndPoint(endpoints[i]);
- //server.ReportNextFailure();
+ // server.ReportNextFailure();
servers[i] = server;
// This awaits either the endpoint's initial connection, or a tracer if we're already connected
@@ -1695,8 +1688,9 @@ internal async Task ReconfigureAsync(bool first, bool reconfigureAll, ILog
ResetAllNonConnected();
log?.LogInformation($" Retrying - attempts left: {attemptsLeft}...");
}
- //WTF("?: " + attempts);
- } while (first && !healthy && attemptsLeft > 0);
+ // WTF("?: " + attempts);
+ }
+ while (first && !healthy && attemptsLeft > 0);
if (first && RawConfig.AbortOnConnectFail && !healthy)
{
diff --git a/src/StackExchange.Redis/CursorEnumerable.cs b/src/StackExchange.Redis/CursorEnumerable.cs
index efe2db61a..55d93d6a6 100644
--- a/src/StackExchange.Redis/CursorEnumerable.cs
+++ b/src/StackExchange.Redis/CursorEnumerable.cs
@@ -12,6 +12,7 @@ namespace StackExchange.Redis
///
/// Provides the ability to iterate over a cursor-based sequence of redis data, synchronously or asynchronously.
///
+ /// The type of the data in the cursor.
internal abstract class CursorEnumerable : IEnumerable, IScanningCursor, IAsyncEnumerable
{
private readonly RedisBase redis;
@@ -91,7 +92,8 @@ internal Enumerator(CursorEnumerable parent, CancellationToken cancellationTo
///
/// Gets the current value of the enumerator.
///
- public T Current {
+ public T Current
+ {
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
@@ -165,7 +167,7 @@ private void ProcessReply(in ScanResult result, bool isInitial)
{
_currentCursor = _nextCursor;
_nextCursor = result.Cursor;
- _pageOffset = isInitial ? parent.initialOffset - 1 : -1;
+ _pageOffset = isInitial ? parent.initialOffset - 1 : -1;
Recycle(ref _pageOversized, ref _isPooled); // recycle any existing data
_pageOversized = result.ValuesOversized ?? Array.Empty();
_isPooled = result.IsPooled;
@@ -206,7 +208,7 @@ private protected TResult Wait(Task pending, Message message)
///
public ValueTask MoveNextAsync()
{
- if(SimpleNext()) return new ValueTask(true);
+ if (SimpleNext()) return new ValueTask(true);
return SlowNextAsync();
}
@@ -274,7 +276,7 @@ private async ValueTask AwaitedNextAsync(bool isInitial)
{
scanResult = await pending.ForAwait();
}
- catch(Exception ex)
+ catch (Exception ex)
{
TryAppendExceptionState(ex);
throw;
@@ -344,8 +346,8 @@ internal static CursorEnumerable From(RedisBase redis, ServerEndPoint? server
private class SingleBlockEnumerable : CursorEnumerable
{
private readonly Task _pending;
- public SingleBlockEnumerable(RedisBase redis, ServerEndPoint? server,
- Task pending, int pageOffset) : base(redis, server, 0, int.MaxValue, 0, pageOffset, default)
+ public SingleBlockEnumerable(RedisBase redis, ServerEndPoint? server, Task pending, int pageOffset)
+ : base(redis, server, 0, int.MaxValue, 0, pageOffset, default)
{
_pending = pending;
}
diff --git a/src/StackExchange.Redis/EndPointCollection.cs b/src/StackExchange.Redis/EndPointCollection.cs
index 44fd67e79..cf4c844c1 100644
--- a/src/StackExchange.Redis/EndPointCollection.cs
+++ b/src/StackExchange.Redis/EndPointCollection.cs
@@ -1,10 +1,10 @@
-using Microsoft.Extensions.Logging;
-using System;
+using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Net;
using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
namespace StackExchange.Redis
{
@@ -23,13 +23,13 @@ private static class DefaultPorts
///
/// Create a new .
///
- public EndPointCollection() {}
+ public EndPointCollection() { }
///
/// Create a new .
///
/// The endpoints to add to the collection.
- public EndPointCollection(IList endpoints) : base(endpoints) {}
+ public EndPointCollection(IList endpoints) : base(endpoints) { }
///
/// Format an .
@@ -165,7 +165,7 @@ internal void SetDefaultPorts(ServerType? serverType, bool ssl = false)
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
- ///
+ ///
public new IEnumerator GetEnumerator()
{
// this does *not* need to handle all threading scenarios; but we do
diff --git a/src/StackExchange.Redis/EndPointEventArgs.cs b/src/StackExchange.Redis/EndPointEventArgs.cs
index 5f8cc6b18..bef0db9b6 100644
--- a/src/StackExchange.Redis/EndPointEventArgs.cs
+++ b/src/StackExchange.Redis/EndPointEventArgs.cs
@@ -11,6 +11,7 @@ public class EndPointEventArgs : EventArgs, ICompletable
{
private readonly EventHandler? handler;
private readonly object sender;
+
internal EndPointEventArgs(EventHandler? handler, object sender, EndPoint endpoint)
{
this.handler = handler;
@@ -24,7 +25,7 @@ internal EndPointEventArgs(EventHandler? handler, object send
/// The source of the event.
/// Redis endpoint.
public EndPointEventArgs(object sender, EndPoint endpoint)
- : this (null, sender, endpoint)
+ : this(null, sender, endpoint)
{
}
diff --git a/src/StackExchange.Redis/Enums/Aggregate.cs b/src/StackExchange.Redis/Enums/Aggregate.cs
index 0c4d890fa..41e1d435d 100644
--- a/src/StackExchange.Redis/Enums/Aggregate.cs
+++ b/src/StackExchange.Redis/Enums/Aggregate.cs
@@ -9,13 +9,15 @@ public enum Aggregate
/// The values of the combined elements are added.
///
Sum,
+
///
/// The least value of the combined elements is used.
///
Min,
+
///
/// The greatest value of the combined elements is used.
///
- Max
+ Max,
}
}
diff --git a/src/StackExchange.Redis/Enums/Bitwise.cs b/src/StackExchange.Redis/Enums/Bitwise.cs
index ada2e99c5..b38423eac 100644
--- a/src/StackExchange.Redis/Enums/Bitwise.cs
+++ b/src/StackExchange.Redis/Enums/Bitwise.cs
@@ -9,14 +9,17 @@ public enum Bitwise
/// And
///
And,
+
///
/// Or
///
Or,
+
///
/// Xor
///
Xor,
+
///
/// Not
///
diff --git a/src/StackExchange.Redis/Enums/ClientFlags.cs b/src/StackExchange.Redis/Enums/ClientFlags.cs
index 50d32261b..eb687bba6 100644
--- a/src/StackExchange.Redis/Enums/ClientFlags.cs
+++ b/src/StackExchange.Redis/Enums/ClientFlags.cs
@@ -85,74 +85,91 @@ public enum ClientFlags : long
/// No specific flag set.
///
None = 0,
+
///
/// The client is a replica in MONITOR mode.
///
[Obsolete("Starting with Redis version 5, Redis has moved to 'replica' terminology. Please use " + nameof(ReplicaMonitor) + " instead, this will be removed in 3.0.")]
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
SlaveMonitor = 1,
+
///
/// The client is a replica in MONITOR mode.
///
ReplicaMonitor = 1, // as an implementation detail, note that enum.ToString on [Flags] prefers *later* options when naming Flags
+
///
/// The client is a normal replica server.
///
[Obsolete("Starting with Redis version 5, Redis has moved to 'replica' terminology. Please use " + nameof(Replica) + " instead, this will be removed in 3.0.")]
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
Slave = 2,
+
///
/// The client is a normal replica server.
///
Replica = 2, // as an implementation detail, note that enum.ToString on [Flags] prefers *later* options when naming Flags
+
///
/// The client is a primary.
///
Master = 4,
+
///
/// The client is in a MULTI/EXEC context.
///
Transaction = 8,
+
///
/// The client is waiting in a blocking operation.
///
Blocked = 16,
+
///
/// A watched keys has been modified - EXEC will fail.
///
TransactionDoomed = 32,
+
///
/// Connection to be closed after writing entire reply.
///
Closing = 64,
+
///
/// The client is unblocked.
///
Unblocked = 128,
+
///
/// Connection to be closed ASAP.
///
CloseASAP = 256,
+
///
/// The client is a Pub/Sub subscriber.
///
PubSubSubscriber = 512,
+
///
/// The client is in readonly mode against a cluster node.
///
ReadOnlyCluster = 1024,
+
///
/// The client is connected via a Unix domain socket.
///
UnixDomainSocket = 2048,
+
///
/// The client enabled keys tracking in order to perform client side caching.
///
KeysTracking = 4096,
+
///
/// The client tracking target client is invalid.
///
TrackingTargetInvalid = 8192,
+
///
/// The client enabled broadcast tracking mode.
///
diff --git a/src/StackExchange.Redis/Enums/ClientType.cs b/src/StackExchange.Redis/Enums/ClientType.cs
index 498c7dd70..c2b003d9a 100644
--- a/src/StackExchange.Redis/Enums/ClientType.cs
+++ b/src/StackExchange.Redis/Enums/ClientType.cs
@@ -4,27 +4,30 @@
namespace StackExchange.Redis
{
///
- /// The class of the connection
+ /// The class of the connection.
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1069:Enums values should not be duplicated", Justification = "Compatibility")]
public enum ClientType
{
///
- /// Regular connections, including MONITOR connections
+ /// Regular connections, including MONITOR connections.
///
Normal = 0,
+
///
- /// Replication connections
+ /// Replication connections.
///
Replica = 1, // as an implementation detail, note that enum.ToString without [Flags] prefers *earlier* values
+
///
- /// Replication connections
+ /// Replication connections.
///
[Obsolete("Starting with Redis version 5, Redis has moved to 'replica' terminology. Please use " + nameof(Replica) + " instead, this will be removed in 3.0.")]
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
Slave = 1,
+
///
- /// Subscription connections
+ /// Subscription connections.
///
PubSub = 2,
}
diff --git a/src/StackExchange.Redis/Enums/CommandFlags.cs b/src/StackExchange.Redis/Enums/CommandFlags.cs
index 95e815a3a..bafaee70f 100644
--- a/src/StackExchange.Redis/Enums/CommandFlags.cs
+++ b/src/StackExchange.Redis/Enums/CommandFlags.cs
@@ -4,7 +4,7 @@
namespace StackExchange.Redis
{
///
- /// Behaviour markers associated with a given command
+ /// Behaviour markers associated with a given command.
///
[Flags]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1069:Enums values should not be duplicated", Justification = "Compatibility")]
@@ -16,11 +16,12 @@ public enum CommandFlags
None = 0,
///
- /// From 2.0, this flag is not used
+ /// From 2.0, this flag is not used.
///
[Obsolete("From 2.0, this flag is not used, this will be removed in 3.0.", false)]
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
HighPriority = 1,
+
///
/// The caller is not interested in the result; the caller will immediately receive a default-value
/// of the expected return type (this value is not indicative of anything at the server).
@@ -69,7 +70,7 @@ public enum CommandFlags
// 32: used for "asking" flag; never user-specified, so not visible on the public API
///
- /// Indicates that this operation should not be forwarded to other servers as a result of an ASK or MOVED response
+ /// Indicates that this operation should not be forwarded to other servers as a result of an ASK or MOVED response.
///
NoRedirect = 64,
@@ -78,7 +79,7 @@ public enum CommandFlags
// 256: used for "script unavailable"; never user-specified, so not visible on the public API
///
- /// Indicates that script-related operations should use EVAL, not SCRIPT LOAD + EVALSHA
+ /// Indicates that script-related operations should use EVAL, not SCRIPT LOAD + EVALSHA.
///
NoScriptCache = 512,
diff --git a/src/StackExchange.Redis/Enums/CommandStatus.cs b/src/StackExchange.Redis/Enums/CommandStatus.cs
index 472c96dfc..c4de5753d 100644
--- a/src/StackExchange.Redis/Enums/CommandStatus.cs
+++ b/src/StackExchange.Redis/Enums/CommandStatus.cs
@@ -9,14 +9,17 @@ public enum CommandStatus
/// Command status unknown.
///
Unknown,
+
///
/// ConnectionMultiplexer has not yet started writing this command to Redis.
///
WaitingToBeSent,
+
///
/// Command has been sent to Redis.
///
Sent,
+
///
/// Command is in the backlog, waiting to be processed and written to Redis.
///
diff --git a/src/StackExchange.Redis/Enums/ConnectionFailureType.cs b/src/StackExchange.Redis/Enums/ConnectionFailureType.cs
index d9407b69e..55eeacef6 100644
--- a/src/StackExchange.Redis/Enums/ConnectionFailureType.cs
+++ b/src/StackExchange.Redis/Enums/ConnectionFailureType.cs
@@ -9,44 +9,54 @@ public enum ConnectionFailureType
/// This event is not a failure.
///
None,
+
///
/// No viable connections were available for this operation.
///
UnableToResolvePhysicalConnection,
+
///
/// The socket for this connection failed.
///
SocketFailure,
+
///
/// Either SSL Stream or Redis authentication failed.
///
AuthenticationFailure,
+
///
/// An unexpected response was received from the server.
///
ProtocolFailure,
+
///
/// An unknown internal error occurred.
///
InternalFailure,
+
///
/// The socket was closed.
///
SocketClosed,
+
///
/// The socket was closed.
///
ConnectionDisposed,
+
///
/// The database is loading and is not available for use.
///
Loading,
+
///
/// It has not been possible to create an initial connection to the redis server(s).
///
UnableToConnect,
+
///
- /// High-integrity mode was enabled, and a failure was detected
+ /// High-integrity mode was enabled, and a failure was detected.
///
ResponseIntegrityFailure,
}
diff --git a/src/StackExchange.Redis/Enums/ConnectionType.cs b/src/StackExchange.Redis/Enums/ConnectionType.cs
index ead82f222..8db655c08 100644
--- a/src/StackExchange.Redis/Enums/ConnectionType.cs
+++ b/src/StackExchange.Redis/Enums/ConnectionType.cs
@@ -9,13 +9,15 @@ public enum ConnectionType
/// Not connection-type related.
///
None = 0,
+
///
/// An interactive connection handles request/response commands for accessing data on demand.
///
Interactive,
+
///
/// A subscriber connection receives unsolicited messages from the server as pub/sub events occur.
///
- Subscription
+ Subscription,
}
}
diff --git a/src/StackExchange.Redis/Enums/Exclude.cs b/src/StackExchange.Redis/Enums/Exclude.cs
index 4da2e9ef4..912a2af95 100644
--- a/src/StackExchange.Redis/Enums/Exclude.cs
+++ b/src/StackExchange.Redis/Enums/Exclude.cs
@@ -13,17 +13,20 @@ public enum Exclude
/// Both start and stop are inclusive.
///
None = 0,
+
///
/// Start is exclusive, stop is inclusive.
///
Start = 1,
+
///
/// Start is inclusive, stop is exclusive.
///
Stop = 2,
+
///
/// Both start and stop are exclusive.
///
- Both = Start | Stop
+ Both = Start | Stop,
}
}
diff --git a/src/StackExchange.Redis/Enums/ExpireWhen.cs b/src/StackExchange.Redis/Enums/ExpireWhen.cs
index 0ed3782bc..2637e7625 100644
--- a/src/StackExchange.Redis/Enums/ExpireWhen.cs
+++ b/src/StackExchange.Redis/Enums/ExpireWhen.cs
@@ -11,20 +11,24 @@ public enum ExpireWhen
/// Set expiry whether or not there is an existing expiry.
///
Always,
+
///
/// Set expiry only when the new expiry is greater than current one.
///
GreaterThanCurrentExpiry,
+
///
/// Set expiry only when the key has an existing expiry.
///
HasExpiry,
+
///
/// Set expiry only when the key has no expiry.
///
HasNoExpiry,
+
///
- /// Set expiry only when the new expiry is less than current one
+ /// Set expiry only when the new expiry is less than current one.
///
LessThanCurrentExpiry,
}
@@ -37,6 +41,6 @@ internal static class ExpiryOptionExtensions
ExpireWhen.HasExpiry => RedisLiterals.XX,
ExpireWhen.GreaterThanCurrentExpiry => RedisLiterals.GT,
ExpireWhen.LessThanCurrentExpiry => RedisLiterals.LT,
- _ => throw new ArgumentOutOfRangeException(nameof(op))
+ _ => throw new ArgumentOutOfRangeException(nameof(op)),
};
}
diff --git a/src/StackExchange.Redis/Enums/ExportOptions.cs b/src/StackExchange.Redis/Enums/ExportOptions.cs
index fd29dd388..594651955 100644
--- a/src/StackExchange.Redis/Enums/ExportOptions.cs
+++ b/src/StackExchange.Redis/Enums/ExportOptions.cs
@@ -12,25 +12,30 @@ public enum ExportOptions
/// No options.
///
None = 0,
+
///
/// The output of INFO.
///
Info = 1,
+
///
/// The output of CONFIG GET *.
///
Config = 2,
+
///
/// The output of CLIENT LIST.
///
Client = 4,
+
///
/// The output of CLUSTER NODES.
///
Cluster = 8,
+
///
/// Everything available.
///
- All = -1
+ All = -1,
}
}
diff --git a/src/StackExchange.Redis/Enums/GeoUnit.cs b/src/StackExchange.Redis/Enums/GeoUnit.cs
index 3f5104742..99ab0a143 100644
--- a/src/StackExchange.Redis/Enums/GeoUnit.cs
+++ b/src/StackExchange.Redis/Enums/GeoUnit.cs
@@ -8,19 +8,22 @@ namespace StackExchange.Redis
public enum GeoUnit
{
///
- /// Meters
+ /// Meters.
///
Meters,
+
///
- /// Kilometers
+ /// Kilometers.
///
Kilometers,
+
///
- /// Miles
+ /// Miles.
///
Miles,
+
///
- /// Feet
+ /// Feet.
///
Feet,
}
@@ -33,7 +36,7 @@ internal static class GeoUnitExtensions
GeoUnit.Kilometers => RedisLiterals.km,
GeoUnit.Meters => RedisLiterals.m,
GeoUnit.Miles => RedisLiterals.mi,
- _ => throw new ArgumentOutOfRangeException(nameof(unit))
+ _ => throw new ArgumentOutOfRangeException(nameof(unit)),
};
}
}
diff --git a/src/StackExchange.Redis/Enums/ListSide.cs b/src/StackExchange.Redis/Enums/ListSide.cs
index dfb74383d..8d326a8af 100644
--- a/src/StackExchange.Redis/Enums/ListSide.cs
+++ b/src/StackExchange.Redis/Enums/ListSide.cs
@@ -11,6 +11,7 @@ public enum ListSide
/// The head of the list.
///
Left,
+
///
/// The tail of the list.
///
@@ -23,7 +24,7 @@ internal static class ListSideExtensions
{
ListSide.Left => RedisLiterals.LEFT,
ListSide.Right => RedisLiterals.RIGHT,
- _ => throw new ArgumentOutOfRangeException(nameof(side))
+ _ => throw new ArgumentOutOfRangeException(nameof(side)),
};
}
}
diff --git a/src/StackExchange.Redis/Enums/MigrateOptions.cs b/src/StackExchange.Redis/Enums/MigrateOptions.cs
index 561b5494d..fbfdaa731 100644
--- a/src/StackExchange.Redis/Enums/MigrateOptions.cs
+++ b/src/StackExchange.Redis/Enums/MigrateOptions.cs
@@ -12,10 +12,12 @@ public enum MigrateOptions
/// No options specified.
///
None = 0,
+
///
/// Do not remove the key from the local instance.
///
Copy = 1,
+
///
/// Replace existing key on the remote instance.
///
diff --git a/src/StackExchange.Redis/Enums/Order.cs b/src/StackExchange.Redis/Enums/Order.cs
index be3dd0a8b..99d989006 100644
--- a/src/StackExchange.Redis/Enums/Order.cs
+++ b/src/StackExchange.Redis/Enums/Order.cs
@@ -11,6 +11,7 @@ public enum Order
/// Ordered from low values to high values.
///
Ascending,
+
///
/// Ordered from high values to low values.
///
@@ -23,7 +24,7 @@ internal static class OrderExtensions
{
Order.Ascending => RedisLiterals.ASC,
Order.Descending => RedisLiterals.DESC,
- _ => throw new ArgumentOutOfRangeException(nameof(order))
+ _ => throw new ArgumentOutOfRangeException(nameof(order)),
};
}
}
diff --git a/src/StackExchange.Redis/Enums/Proxy.cs b/src/StackExchange.Redis/Enums/Proxy.cs
index f529ac123..9dc1d3770 100644
--- a/src/StackExchange.Redis/Enums/Proxy.cs
+++ b/src/StackExchange.Redis/Enums/Proxy.cs
@@ -9,10 +9,12 @@ public enum Proxy
/// Direct communication to the redis server(s).
///
None,
+
///
/// Communication via twemproxy.
///
Twemproxy,
+
///
/// Communication via envoyproxy.
///
@@ -28,7 +30,7 @@ internal static class ProxyExtensions
{
Proxy.Twemproxy => false,
Proxy.Envoyproxy => false,
- _ => true
+ _ => true,
};
///
@@ -38,7 +40,7 @@ internal static class ProxyExtensions
{
Proxy.Twemproxy => false,
Proxy.Envoyproxy => false,
- _ => true
+ _ => true,
};
///
@@ -48,7 +50,7 @@ internal static class ProxyExtensions
{
Proxy.Twemproxy => false,
Proxy.Envoyproxy => false,
- _ => true
+ _ => true,
};
}
}
diff --git a/src/StackExchange.Redis/Enums/RedisType.cs b/src/StackExchange.Redis/Enums/RedisType.cs
index b061dc906..f1da87505 100644
--- a/src/StackExchange.Redis/Enums/RedisType.cs
+++ b/src/StackExchange.Redis/Enums/RedisType.cs
@@ -10,6 +10,7 @@ public enum RedisType
/// The specified key does not exist.
///
None,
+
///
/// Strings are the most basic kind of Redis value. Redis Strings are binary safe, this means that
/// a Redis string can contain any kind of data, for instance a JPEG image or a serialized Ruby object.
@@ -17,6 +18,7 @@ public enum RedisType
///
///
String,
+
///
/// Redis Lists are simply lists of strings, sorted by insertion order.
/// It is possible to add elements to a Redis List pushing new elements on the head (on the left) or
@@ -24,6 +26,7 @@ public enum RedisType
///
///
List,
+
///
/// Redis Sets are an unordered collection of Strings. It is possible to add, remove, and test for
/// existence of members in O(1) (constant time regardless of the number of elements contained inside the Set).
@@ -33,6 +36,7 @@ public enum RedisType
///
///
Set,
+
///
/// Redis Sorted Sets are, similarly to Redis Sets, non repeating collections of Strings.
/// The difference is that every member of a Sorted Set is associated with score, that is used
@@ -41,12 +45,14 @@ public enum RedisType
///
///
SortedSet,
+
///
/// Redis Hashes are maps between string fields and string values, so they are the perfect data type
/// to represent objects (e.g. A User with a number of fields like name, surname, age, and so forth).
///
///
Hash,
+
///
/// A Redis Stream is a data structure which models the behavior of an append only log but it has more
/// advanced features for manipulating the data contained within the stream. Each entry in a
@@ -54,6 +60,7 @@ public enum RedisType
///
///
Stream,
+
///
/// The data-type was not recognised by the client library.
///
diff --git a/src/StackExchange.Redis/Enums/ReplicationChangeOptions.cs b/src/StackExchange.Redis/Enums/ReplicationChangeOptions.cs
index 12f84ffba..897ebbb6c 100644
--- a/src/StackExchange.Redis/Enums/ReplicationChangeOptions.cs
+++ b/src/StackExchange.Redis/Enums/ReplicationChangeOptions.cs
@@ -14,24 +14,29 @@ public enum ReplicationChangeOptions
/// No additional operations.
///
None = 0,
+
///
/// Set the tie-breaker key on all available primaries, to specify this server.
///
SetTiebreaker = 1,
+
///
/// Broadcast to the pub-sub channel to listening clients to reconfigure themselves.
///
Broadcast = 2,
+
///
/// Issue a REPLICAOF to all other known nodes, making this primary of all.
///
[Obsolete("Starting with Redis version 5, Redis has moved to 'replica' terminology. Please use " + nameof(ReplicateToOtherEndpoints) + " instead, this will be removed in 3.0.")]
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
EnslaveSubordinates = 4,
+
///
/// Issue a REPLICAOF to all other known nodes, making this primary of all.
///
ReplicateToOtherEndpoints = 4, // note ToString prefers *later* options
+
///
/// All additional operations.
///
diff --git a/src/StackExchange.Redis/Enums/ResultType.cs b/src/StackExchange.Redis/Enums/ResultType.cs
index ca09f64b0..63e267a91 100644
--- a/src/StackExchange.Redis/Enums/ResultType.cs
+++ b/src/StackExchange.Redis/Enums/ResultType.cs
@@ -19,14 +19,17 @@ public enum ResultType : byte
/// Basic strings typically represent status results such as "OK".
///
SimpleString = 1,
+
///
/// Error strings represent invalid operation results from the server.
///
Error = 2,
+
///
/// Integers are returned for count operations and some integer-based increment operations.
///
Integer = 3,
+
///
/// Bulk strings represent typical user content values.
///
@@ -65,7 +68,7 @@ public enum ResultType : byte
Double = (1 << 3) | SimpleString,
///
- /// A large number non representable by the type
+ /// A large number non representable by the type.
///
BigInteger = (2 << 3) | SimpleString,
diff --git a/src/StackExchange.Redis/Enums/RetransmissionReasonType.cs b/src/StackExchange.Redis/Enums/RetransmissionReasonType.cs
index 18529b029..6bd9d43e6 100644
--- a/src/StackExchange.Redis/Enums/RetransmissionReasonType.cs
+++ b/src/StackExchange.Redis/Enums/RetransmissionReasonType.cs
@@ -16,10 +16,12 @@ public enum RetransmissionReasonType
/// No stated reason.
///
None = 0,
+
///
/// Issued to investigate which node owns a key.
///
Ask,
+
///
/// A node has indicated that it does *not* own the given key.
///
diff --git a/src/StackExchange.Redis/Enums/SaveType.cs b/src/StackExchange.Redis/Enums/SaveType.cs
index 740e262a9..5296d110e 100644
--- a/src/StackExchange.Redis/Enums/SaveType.cs
+++ b/src/StackExchange.Redis/Enums/SaveType.cs
@@ -13,6 +13,7 @@ public enum SaveType
///
///
BackgroundRewriteAppendOnlyFile,
+
///
/// Save the DB in background. The OK code is immediately returned.
/// Redis forks, the parent continues to serve the clients, the child saves the DB on disk then exits.
@@ -20,6 +21,7 @@ public enum SaveType
///
///
BackgroundSave,
+
///
/// Save the DB in foreground.
/// This is almost never a good thing to do, and could cause significant blocking.
diff --git a/src/StackExchange.Redis/Enums/ServerType.cs b/src/StackExchange.Redis/Enums/ServerType.cs
index 19c6a3f19..ef49a8449 100644
--- a/src/StackExchange.Redis/Enums/ServerType.cs
+++ b/src/StackExchange.Redis/Enums/ServerType.cs
@@ -9,18 +9,22 @@ public enum ServerType
/// Classic redis-server server.
///
Standalone,
+
///
/// Monitoring/configuration redis-sentinel server.
///
Sentinel,
+
///
/// Distributed redis-cluster server.
///
Cluster,
+
///
/// Distributed redis installation via twemproxy.
///
Twemproxy,
+
///
/// Redis cluster via envoyproxy.
///
@@ -35,7 +39,7 @@ internal static class ServerTypeExtensions
internal static bool HasSinglePrimary(this ServerType type) => type switch
{
ServerType.Envoyproxy => false,
- _ => true
+ _ => true,
};
///
@@ -45,7 +49,7 @@ internal static class ServerTypeExtensions
{
ServerType.Twemproxy => false,
ServerType.Envoyproxy => false,
- _ => true
+ _ => true,
};
}
}
diff --git a/src/StackExchange.Redis/Enums/SetOperation.cs b/src/StackExchange.Redis/Enums/SetOperation.cs
index 7e649847f..a529d348e 100644
--- a/src/StackExchange.Redis/Enums/SetOperation.cs
+++ b/src/StackExchange.Redis/Enums/SetOperation.cs
@@ -11,10 +11,12 @@ public enum SetOperation
/// Returns the members of the set resulting from the union of all the given sets.
///
Union,
+
///
/// Returns the members of the set resulting from the intersection of all the given sets.
///
Intersect,
+
///
/// Returns the members of the set resulting from the difference between the first set and all the successive sets.
///
@@ -25,12 +27,12 @@ internal static class SetOperationExtensions
{
internal static RedisCommand ToCommand(this SetOperation operation, bool store) => operation switch
{
- SetOperation.Intersect when store => RedisCommand.ZINTERSTORE,
- SetOperation.Intersect => RedisCommand.ZINTER,
- SetOperation.Union when store => RedisCommand.ZUNIONSTORE,
- SetOperation.Union => RedisCommand.ZUNION,
+ SetOperation.Intersect when store => RedisCommand.ZINTERSTORE,
+ SetOperation.Intersect => RedisCommand.ZINTER,
+ SetOperation.Union when store => RedisCommand.ZUNIONSTORE,
+ SetOperation.Union => RedisCommand.ZUNION,
SetOperation.Difference when store => RedisCommand.ZDIFFSTORE,
- SetOperation.Difference => RedisCommand.ZDIFF,
+ SetOperation.Difference => RedisCommand.ZDIFF,
_ => throw new ArgumentOutOfRangeException(nameof(operation)),
};
}
diff --git a/src/StackExchange.Redis/Enums/ShutdownMode.cs b/src/StackExchange.Redis/Enums/ShutdownMode.cs
index dfd46b70f..a8b701ea8 100644
--- a/src/StackExchange.Redis/Enums/ShutdownMode.cs
+++ b/src/StackExchange.Redis/Enums/ShutdownMode.cs
@@ -9,10 +9,12 @@ public enum ShutdownMode
/// The data is persisted if save points are configured.
///
Default,
+
///
/// The data is NOT persisted even if save points are configured.
///
Never,
+
///
/// The data is persisted even if save points are NOT configured.
///
diff --git a/src/StackExchange.Redis/Enums/SimulatedFailureType.cs b/src/StackExchange.Redis/Enums/SimulatedFailureType.cs
index 80fca095c..7f2968eca 100644
--- a/src/StackExchange.Redis/Enums/SimulatedFailureType.cs
+++ b/src/StackExchange.Redis/Enums/SimulatedFailureType.cs
@@ -5,10 +5,10 @@ namespace StackExchange.Redis
[Flags]
internal enum SimulatedFailureType
{
- None = 0,
- InteractiveInbound = 1 << 0,
- InteractiveOutbound = 1 << 1,
- SubscriptionInbound = 1 << 2,
+ None = 0,
+ InteractiveInbound = 1 << 0,
+ InteractiveOutbound = 1 << 1,
+ SubscriptionInbound = 1 << 2,
SubscriptionOutbound = 1 << 3,
AllInbound = InteractiveInbound | SubscriptionInbound,
diff --git a/src/StackExchange.Redis/Enums/SortType.cs b/src/StackExchange.Redis/Enums/SortType.cs
index 9fc3a20ae..48a3596b6 100644
--- a/src/StackExchange.Redis/Enums/SortType.cs
+++ b/src/StackExchange.Redis/Enums/SortType.cs
@@ -9,6 +9,7 @@ public enum SortType
/// Elements are interpreted as a double-precision floating point number and sorted numerically.
///
Numeric,
+
///
/// Elements are sorted using their alphabetic form
/// (Redis is UTF-8 aware as long as the !LC_COLLATE environment variable is set at the server).
diff --git a/src/StackExchange.Redis/Enums/SortedSetOrder.cs b/src/StackExchange.Redis/Enums/SortedSetOrder.cs
index 6c205bae0..474cd3612 100644
--- a/src/StackExchange.Redis/Enums/SortedSetOrder.cs
+++ b/src/StackExchange.Redis/Enums/SortedSetOrder.cs
@@ -16,7 +16,7 @@ public enum SortedSetOrder
ByScore,
///
- /// Bases ordering off of lexicographical order, this is only appropriate in an instance where all the members of your sorted set are given the same score
+ /// Bases ordering off of lexicographical order, this is only appropriate in an instance where all the members of your sorted set are given the same score.
///
ByLex,
}
@@ -27,6 +27,6 @@ internal static class SortedSetOrderByExtensions
{
SortedSetOrder.ByLex => RedisLiterals.BYLEX,
SortedSetOrder.ByScore => RedisLiterals.BYSCORE,
- _ => RedisValue.Null
+ _ => RedisValue.Null,
};
}
diff --git a/src/StackExchange.Redis/Enums/SortedSetWhen.cs b/src/StackExchange.Redis/Enums/SortedSetWhen.cs
index a394482b6..517aaeaa5 100644
--- a/src/StackExchange.Redis/Enums/SortedSetWhen.cs
+++ b/src/StackExchange.Redis/Enums/SortedSetWhen.cs
@@ -12,18 +12,22 @@ public enum SortedSetWhen
/// The operation won't be prevented.
///
Always = 0,
+
///
/// The operation should only occur when there is an existing value.
///
Exists = 1 << 0,
+
///
/// The operation should only occur when the new score is greater than the current score.
///
GreaterThan = 1 << 1,
+
///
/// The operation should only occur when the new score is less than the current score.
///
LessThan = 1 << 2,
+
///
/// The operation should only occur when there is not an existing value.
///
@@ -35,18 +39,18 @@ internal static class SortedSetWhenExtensions
internal static uint CountBits(this SortedSetWhen when)
{
uint v = (uint)when;
- v -= ((v >> 1) & 0x55555555); // reuse input as temporary
+ v -= (v >> 1) & 0x55555555; // reuse input as temporary
v = (v & 0x33333333) + ((v >> 2) & 0x33333333); // temp
uint c = ((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; // count
return c;
}
- internal static SortedSetWhen Parse(When when)=> when switch
+ internal static SortedSetWhen Parse(When when) => when switch
{
When.Always => SortedSetWhen.Always,
When.Exists => SortedSetWhen.Exists,
When.NotExists => SortedSetWhen.NotExists,
- _ => throw new ArgumentOutOfRangeException(nameof(when))
+ _ => throw new ArgumentOutOfRangeException(nameof(when)),
};
}
}
diff --git a/src/StackExchange.Redis/Enums/StringIndexType.cs b/src/StackExchange.Redis/Enums/StringIndexType.cs
index deb180404..fcb41e391 100644
--- a/src/StackExchange.Redis/Enums/StringIndexType.cs
+++ b/src/StackExchange.Redis/Enums/StringIndexType.cs
@@ -11,6 +11,7 @@ public enum StringIndexType
/// Indicates the index is the number of bytes into a string.
///
Byte,
+
///
/// Indicates the index is the number of bits into a string.
///
@@ -23,6 +24,6 @@ internal static class StringIndexTypeExtensions
{
StringIndexType.Bit => RedisLiterals.BIT,
StringIndexType.Byte => RedisLiterals.BYTE,
- _ => throw new ArgumentOutOfRangeException(nameof(indexType))
+ _ => throw new ArgumentOutOfRangeException(nameof(indexType)),
};
}
diff --git a/src/StackExchange.Redis/Enums/When.cs b/src/StackExchange.Redis/Enums/When.cs
index d0bc5d303..412e4064a 100644
--- a/src/StackExchange.Redis/Enums/When.cs
+++ b/src/StackExchange.Redis/Enums/When.cs
@@ -9,10 +9,12 @@ public enum When
/// The operation should occur whether or not there is an existing value.
///
Always,
+
///
/// The operation should only occur when there is an existing value.
///
Exists,
+
///
/// The operation should only occur when there is not an existing value.
///
diff --git a/src/StackExchange.Redis/ExceptionFactory.cs b/src/StackExchange.Redis/ExceptionFactory.cs
index fd1953de6..24e519b54 100644
--- a/src/StackExchange.Redis/ExceptionFactory.cs
+++ b/src/StackExchange.Redis/ExceptionFactory.cs
@@ -102,8 +102,8 @@ internal static Exception NoConnectionAvailable(
if (server != null)
{
- //if we already have the serverEndpoint for connection failure use that
- //otherwise it would output state of all the endpoints
+ // If we already have the serverEndpoint for connection failure use that,
+ // otherwise it would output state of all the endpoints.
serverSnapshot = new ServerEndPoint[] { server };
}
@@ -283,11 +283,11 @@ internal static Exception Timeout(ConnectionMultiplexer multiplexer, string? bas
Exception ex = logConnectionException && lastConnectionException is not null
? new RedisConnectionException(lastConnectionException.FailureType, sb.ToString(), lastConnectionException, message?.Status ?? CommandStatus.Unknown)
{
- HelpLink = TimeoutHelpLink
+ HelpLink = TimeoutHelpLink,
}
: new RedisTimeoutException(sb.ToString(), message?.Status ?? CommandStatus.Unknown)
{
- HelpLink = TimeoutHelpLink
+ HelpLink = TimeoutHelpLink,
};
CopyDataToException(data, ex);
@@ -312,8 +312,7 @@ private static void AddCommonDetail(
StringBuilder sb,
Message? message,
ConnectionMultiplexer multiplexer,
- ServerEndPoint? server
- )
+ ServerEndPoint? server)
{
if (message != null)
{
@@ -325,7 +324,7 @@ private static void AddCommonDetail(
// Add server data, if we have it
if (server != null && message != null)
{
- var bs = server.GetBridgeStatus(message.IsForSubscriptionBridge ? ConnectionType.Subscription: ConnectionType.Interactive);
+ var bs = server.GetBridgeStatus(message.IsForSubscriptionBridge ? ConnectionType.Subscription : ConnectionType.Interactive);
switch (bs.Connection.ReadStatus)
{
diff --git a/src/StackExchange.Redis/Exceptions.cs b/src/StackExchange.Redis/Exceptions.cs
index 17abcc21c..9315eb806 100644
--- a/src/StackExchange.Redis/Exceptions.cs
+++ b/src/StackExchange.Redis/Exceptions.cs
@@ -50,6 +50,7 @@ private RedisTimeoutException(SerializationInfo info, StreamingContext ctx) : ba
{
Commandstatus = info.GetValue("commandStatus", typeof(CommandStatus)) as CommandStatus? ?? CommandStatus.Unknown;
}
+
///
/// Serialization implementation; not intended for general usage.
///
@@ -73,7 +74,7 @@ public sealed partial class RedisConnectionException : RedisException
///
/// The type of connection failure.
/// The message for the exception.
- public RedisConnectionException(ConnectionFailureType failureType, string message) : this(failureType, message, null, CommandStatus.Unknown) {}
+ public RedisConnectionException(ConnectionFailureType failureType, string message) : this(failureType, message, null, CommandStatus.Unknown) { }
///
/// Creates a new .
@@ -81,7 +82,7 @@ public RedisConnectionException(ConnectionFailureType failureType, string messag
/// The type of connection failure.
/// The message for the exception.
/// The inner exception.
- public RedisConnectionException(ConnectionFailureType failureType, string message, Exception? innerException) : this(failureType, message, innerException, CommandStatus.Unknown) {}
+ public RedisConnectionException(ConnectionFailureType failureType, string message, Exception? innerException) : this(failureType, message, innerException, CommandStatus.Unknown) { }
///
/// Creates a new .
@@ -111,6 +112,7 @@ private RedisConnectionException(SerializationInfo info, StreamingContext ctx) :
FailureType = (ConnectionFailureType)info.GetInt32("failureType");
CommandStatus = info.GetValue("commandStatus", typeof(CommandStatus)) as CommandStatus? ?? CommandStatus.Unknown;
}
+
///
/// Serialization implementation; not intended for general usage.
///
diff --git a/src/StackExchange.Redis/ExponentialRetry.cs b/src/StackExchange.Redis/ExponentialRetry.cs
index 4cf965abc..f28708679 100644
--- a/src/StackExchange.Redis/ExponentialRetry.cs
+++ b/src/StackExchange.Redis/ExponentialRetry.cs
@@ -15,14 +15,14 @@ public class ExponentialRetry : IReconnectRetryPolicy
///
/// Initializes a new instance using the specified back off interval with default maxDeltaBackOffMilliseconds of 10 seconds.
///
- /// time in milliseconds for the back-off interval between retries
+ /// Time in milliseconds for the back-off interval between retries.
public ExponentialRetry(int deltaBackOffMilliseconds) : this(deltaBackOffMilliseconds, Math.Max(deltaBackOffMilliseconds, (int)TimeSpan.FromSeconds(10).TotalMilliseconds)) { }
///
/// Initializes a new instance using the specified back off interval.
///
- /// time in milliseconds for the back-off interval between retries.
- /// time in milliseconds for the maximum value that the back-off interval can exponentially grow up to.
+ /// Time in milliseconds for the back-off interval between retries.
+ /// Time in milliseconds for the maximum value that the back-off interval can exponentially grow up to.
public ExponentialRetry(int deltaBackOffMilliseconds, int maxDeltaBackOffMilliseconds)
{
if (deltaBackOffMilliseconds < 0)
@@ -54,16 +54,16 @@ public bool ShouldRetry(long currentRetryCount, int timeElapsedMillisecondsSince
r ??= new Random();
random = r.Next((int)deltaBackOffMilliseconds, exponential);
return timeElapsedMillisecondsSinceLastRetry >= random;
- //exponential backoff with deltaBackOff of 5000ms
- //deltabackoff exponential
- //5000 5500
- //5000 6050
- //5000 6655
- //5000 8053
- //5000 10718
- //5000 17261
- //5000 37001
- //5000 127738
+ // exponential backoff with deltaBackOff of 5000ms
+ // deltabackoff exponential
+ // 5000 5500
+ // 5000 6050
+ // 5000 6655
+ // 5000 8053
+ // 5000 10718
+ // 5000 17261
+ // 5000 37001
+ // 5000 127738
}
}
}
diff --git a/src/StackExchange.Redis/ExtensionMethods.cs b/src/StackExchange.Redis/ExtensionMethods.cs
index 89b9a0e21..87904aa9c 100644
--- a/src/StackExchange.Redis/ExtensionMethods.cs
+++ b/src/StackExchange.Redis/ExtensionMethods.cs
@@ -21,7 +21,7 @@ public static class ExtensionMethods
///
/// The entry to convert to a dictionary.
[return: NotNullIfNotNull("hash")]
- public static Dictionary? ToStringDictionary(this HashEntry[]? hash)
+ public static Dictionary? ToStringDictionary(this HashEntry[]? hash)
{
if (hash is null)
{
@@ -29,7 +29,7 @@ public static class ExtensionMethods
}
var result = new Dictionary(hash.Length, StringComparer.Ordinal);
- for(int i = 0; i < hash.Length; i++)
+ for (int i = 0; i < hash.Length; i++)
{
result.Add(hash[i].name!, hash[i].value!);
}
@@ -192,7 +192,7 @@ internal static void AuthenticateAsClient(this SslStream ssl, string host, SslPr
{
if (!allowedProtocols.HasValue)
{
- //Default to the sslProtocols defined by the .NET Framework
+ // Default to the sslProtocols defined by the .NET Framework
AuthenticateAsClientUsingDefaultProtocols(ssl, host);
return;
}
@@ -278,9 +278,8 @@ private static void AuthenticateAsClientUsingDefaultProtocols(SslStream ssl, str
private sealed class LeaseMemoryStream : MemoryStream
{
private readonly IDisposable _parent;
- public LeaseMemoryStream(ArraySegment segment, IDisposable parent)
- : base(segment.Array!, segment.Offset, segment.Count, false, true)
- => _parent = parent;
+
+ public LeaseMemoryStream(ArraySegment segment, IDisposable parent) : base(segment.Array!, segment.Offset, segment.Count, false, true) => _parent = parent;
protected override void Dispose(bool disposing)
{
@@ -302,7 +301,6 @@ protected override void Dispose(bool disposing)
// assembly-binding-redirect entries to fix this up, so; it would present an unreasonable support burden
// otherwise. And yes, I've tried explicitly referencing System.Numerics.Vectors in the manifest to
// force it... nothing. Nada.
-
#if VECTOR_SAFE
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static int VectorSafeIndexOf(this ReadOnlySpan span, byte value)
@@ -325,12 +323,13 @@ internal static int VectorSafeIndexOf(this ReadOnlySpan span, byte value)
}
return -1;
}
+
internal static int VectorSafeIndexOfCRLF(this ReadOnlySpan span)
{
// yes, this has zero optimization; I'm OK with this as the fallback strategy
for (int i = 1; i < span.Length; i++)
{
- if (span[i] == '\n' && span[i-1] == '\r') return i - 1;
+ if (span[i] == '\n' && span[i - 1] == '\r') return i - 1;
}
return -1;
}
diff --git a/src/StackExchange.Redis/Format.cs b/src/StackExchange.Redis/Format.cs
index 73c29a82e..6836a70da 100644
--- a/src/StackExchange.Redis/Format.cs
+++ b/src/StackExchange.Redis/Format.cs
@@ -1,10 +1,10 @@
using System;
using System.Buffers;
using System.Buffers.Text;
+using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Net;
using System.Text;
-using System.Diagnostics.CodeAnalysis;
#if UNIX_SOCKET
using System.Net.Sockets;
@@ -86,7 +86,7 @@ internal static string ToString(double value)
float f => ToString(f),
double d => ToString(d),
EndPoint e => ToString(e),
- _ => Convert.ToString(value, CultureInfo.InvariantCulture)
+ _ => Convert.ToString(value, CultureInfo.InvariantCulture),
};
internal static string ToString(EndPoint? endpoint)
@@ -113,7 +113,7 @@ internal static string ToStringHostOnly(EndPoint endpoint) =>
{
DnsEndPoint dns => dns.Host,
IPEndPoint ip => ip.Address.ToString(),
- _ => ""
+ _ => "",
};
internal static bool TryGetHostPort(EndPoint? endpoint, [NotNullWhen(true)] out string? host, [NotNullWhen(true)] out int? port)
@@ -258,7 +258,7 @@ private static bool CaseInsensitiveASCIIEqual(string xLowerCase, ReadOnlySpan
///
/// Adapted from IPEndPointParser in Microsoft.AspNetCore
- /// Link:
+ /// Link: .
///
///
/// Copyright (c) .NET Foundation. All rights reserved.
@@ -276,7 +276,7 @@ internal static bool TryParseEndPoint(string? addressWithPort, [NotNullWhen(true
return false;
}
- if (addressWithPort[0]=='!')
+ if (addressWithPort[0] == '!')
{
if (addressWithPort.Length == 1)
{
diff --git a/src/StackExchange.Redis/GlobalSuppressions.cs b/src/StackExchange.Redis/GlobalSuppressions.cs
index 3882f4776..84d04d110 100644
--- a/src/StackExchange.Redis/GlobalSuppressions.cs
+++ b/src/StackExchange.Redis/GlobalSuppressions.cs
@@ -5,17 +5,17 @@
using System.Diagnostics.CodeAnalysis;
-[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "", Scope = "member", Target = "~P:StackExchange.Redis.Message.IsAdmin")]
-[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "", Scope = "member", Target = "~M:StackExchange.Redis.ServerEndPoint.GetBridge(StackExchange.Redis.RedisCommand,System.Boolean)~StackExchange.Redis.PhysicalBridge")]
-[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "", Scope = "member", Target = "~M:StackExchange.Redis.RedisValue.op_Equality(StackExchange.Redis.RedisValue,StackExchange.Redis.RedisValue)~System.Boolean")]
-[assembly: SuppressMessage("Style", "IDE0075:Simplify conditional expression", Justification = "", Scope = "member", Target = "~M:StackExchange.Redis.RedisSubscriber.Unsubscribe(StackExchange.Redis.RedisChannel@,System.Action{StackExchange.Redis.RedisChannel,StackExchange.Redis.RedisValue},StackExchange.Redis.ChannelMessageQueue,StackExchange.Redis.CommandFlags)~System.Boolean")]
-[assembly: SuppressMessage("Roslynator", "RCS1104:Simplify conditional expression.", Justification = "", Scope = "member", Target = "~M:StackExchange.Redis.RedisSubscriber.Unsubscribe(StackExchange.Redis.RedisChannel@,System.Action{StackExchange.Redis.RedisChannel,StackExchange.Redis.RedisValue},StackExchange.Redis.ChannelMessageQueue,StackExchange.Redis.CommandFlags)~System.Boolean")]
-[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "", Scope = "member", Target = "~M:StackExchange.Redis.Message.IsPrimaryOnly(StackExchange.Redis.RedisCommand)~System.Boolean")]
-[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "", Scope = "member", Target = "~M:StackExchange.Redis.Message.RequiresDatabase(StackExchange.Redis.RedisCommand)~System.Boolean")]
-[assembly: SuppressMessage("Style", "IDE0180:Use tuple to swap values", Justification = "", Scope = "member", Target = "~M:StackExchange.Redis.RedisDatabase.ReverseLimits(StackExchange.Redis.Order,StackExchange.Redis.Exclude@,StackExchange.Redis.RedisValue@,StackExchange.Redis.RedisValue@)")]
-[assembly: SuppressMessage("Style", "IDE0180:Use tuple to swap values", Justification = "", Scope = "member", Target = "~M:StackExchange.Redis.RedisDatabase.GetSortedSetRangeByScoreMessage(StackExchange.Redis.RedisKey,System.Double,System.Double,StackExchange.Redis.Exclude,StackExchange.Redis.Order,System.Int64,System.Int64,StackExchange.Redis.CommandFlags,System.Boolean)~StackExchange.Redis.Message")]
-[assembly: SuppressMessage("Reliability", "CA2012:Use ValueTasks correctly", Justification = "", Scope = "member", Target = "~M:StackExchange.Redis.PhysicalConnection.FlushSync(System.Boolean,System.Int32)~StackExchange.Redis.WriteResult")]
-[assembly: SuppressMessage("Usage", "CA2219:Do not raise exceptions in finally clauses", Justification = "", Scope = "member", Target = "~M:StackExchange.Redis.PhysicalBridge.ProcessBacklogAsync~System.Threading.Tasks.Task")]
-[assembly: SuppressMessage("Usage", "CA2249:Consider using 'string.Contains' instead of 'string.IndexOf'", Justification = "", Scope = "member", Target = "~M:StackExchange.Redis.ClientInfo.AddFlag(StackExchange.Redis.ClientFlags@,System.String,StackExchange.Redis.ClientFlags,System.Char)")]
-[assembly: SuppressMessage("Style", "IDE0070:Use 'System.HashCode'", Justification = "", Scope = "member", Target = "~M:StackExchange.Redis.CommandBytes.GetHashCode~System.Int32")]
-[assembly: SuppressMessage("Roslynator", "RCS1085:Use auto-implemented property.", Justification = "", Scope = "member", Target = "~P:StackExchange.Redis.RedisValue.OverlappedValueInt64")]
+[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "Pending", Scope = "member", Target = "~P:StackExchange.Redis.Message.IsAdmin")]
+[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "Pending", Scope = "member", Target = "~M:StackExchange.Redis.ServerEndPoint.GetBridge(StackExchange.Redis.RedisCommand,System.Boolean)~StackExchange.Redis.PhysicalBridge")]
+[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "Pending", Scope = "member", Target = "~M:StackExchange.Redis.RedisValue.op_Equality(StackExchange.Redis.RedisValue,StackExchange.Redis.RedisValue)~System.Boolean")]
+[assembly: SuppressMessage("Style", "IDE0075:Simplify conditional expression", Justification = "Pending", Scope = "member", Target = "~M:StackExchange.Redis.RedisSubscriber.Unsubscribe(StackExchange.Redis.RedisChannel@,System.Action{StackExchange.Redis.RedisChannel,StackExchange.Redis.RedisValue},StackExchange.Redis.ChannelMessageQueue,StackExchange.Redis.CommandFlags)~System.Boolean")]
+[assembly: SuppressMessage("Roslynator", "RCS1104:Simplify conditional expression.", Justification = "Pending", Scope = "member", Target = "~M:StackExchange.Redis.RedisSubscriber.Unsubscribe(StackExchange.Redis.RedisChannel@,System.Action{StackExchange.Redis.RedisChannel,StackExchange.Redis.RedisValue},StackExchange.Redis.ChannelMessageQueue,StackExchange.Redis.CommandFlags)~System.Boolean")]
+[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "Pending", Scope = "member", Target = "~M:StackExchange.Redis.Message.IsPrimaryOnly(StackExchange.Redis.RedisCommand)~System.Boolean")]
+[assembly: SuppressMessage("Style", "IDE0066:Convert switch statement to expression", Justification = "Pending", Scope = "member", Target = "~M:StackExchange.Redis.Message.RequiresDatabase(StackExchange.Redis.RedisCommand)~System.Boolean")]
+[assembly: SuppressMessage("Style", "IDE0180:Use tuple to swap values", Justification = "Pending", Scope = "member", Target = "~M:StackExchange.Redis.RedisDatabase.ReverseLimits(StackExchange.Redis.Order,StackExchange.Redis.Exclude@,StackExchange.Redis.RedisValue@,StackExchange.Redis.RedisValue@)")]
+[assembly: SuppressMessage("Style", "IDE0180:Use tuple to swap values", Justification = "Pending", Scope = "member", Target = "~M:StackExchange.Redis.RedisDatabase.GetSortedSetRangeByScoreMessage(StackExchange.Redis.RedisKey,System.Double,System.Double,StackExchange.Redis.Exclude,StackExchange.Redis.Order,System.Int64,System.Int64,StackExchange.Redis.CommandFlags,System.Boolean)~StackExchange.Redis.Message")]
+[assembly: SuppressMessage("Reliability", "CA2012:Use ValueTasks correctly", Justification = "Pending", Scope = "member", Target = "~M:StackExchange.Redis.PhysicalConnection.FlushSync(System.Boolean,System.Int32)~StackExchange.Redis.WriteResult")]
+[assembly: SuppressMessage("Usage", "CA2219:Do not raise exceptions in finally clauses", Justification = "Pending", Scope = "member", Target = "~M:StackExchange.Redis.PhysicalBridge.ProcessBacklogAsync~System.Threading.Tasks.Task")]
+[assembly: SuppressMessage("Usage", "CA2249:Consider using 'string.Contains' instead of 'string.IndexOf'", Justification = "Pending", Scope = "member", Target = "~M:StackExchange.Redis.ClientInfo.AddFlag(StackExchange.Redis.ClientFlags@,System.String,StackExchange.Redis.ClientFlags,System.Char)")]
+[assembly: SuppressMessage("Style", "IDE0070:Use 'System.HashCode'", Justification = "Pending", Scope = "member", Target = "~M:StackExchange.Redis.CommandBytes.GetHashCode~System.Int32")]
+[assembly: SuppressMessage("Roslynator", "RCS1085:Use auto-implemented property.", Justification = "Pending", Scope = "member", Target = "~P:StackExchange.Redis.RedisValue.OverlappedValueInt64")]
diff --git a/src/StackExchange.Redis/HashSlotMovedEventArgs.cs b/src/StackExchange.Redis/HashSlotMovedEventArgs.cs
index d92c2af8c..876088e5c 100644
--- a/src/StackExchange.Redis/HashSlotMovedEventArgs.cs
+++ b/src/StackExchange.Redis/HashSlotMovedEventArgs.cs
@@ -27,8 +27,7 @@ public class HashSlotMovedEventArgs : EventArgs, ICompletable
///
public EndPoint NewEndPoint { get; }
- internal HashSlotMovedEventArgs(EventHandler? handler, object sender,
- int hashSlot, EndPoint? old, EndPoint @new)
+ internal HashSlotMovedEventArgs(EventHandler? handler, object sender, int hashSlot, EndPoint? old, EndPoint @new)
{
this.handler = handler;
this.sender = sender;
@@ -45,7 +44,7 @@ internal HashSlotMovedEventArgs(EventHandler? handler, o
/// Old endpoint.
/// New endpoint.
public HashSlotMovedEventArgs(object sender, int hashSlot, EndPoint old, EndPoint @new)
- : this (null, sender, hashSlot, old, @new)
+ : this(null, sender, hashSlot, old, @new)
{
}
diff --git a/src/StackExchange.Redis/Interfaces/IConnectionMultiplexer.cs b/src/StackExchange.Redis/Interfaces/IConnectionMultiplexer.cs
index 25d2f7099..b4bdb0950 100644
--- a/src/StackExchange.Redis/Interfaces/IConnectionMultiplexer.cs
+++ b/src/StackExchange.Redis/Interfaces/IConnectionMultiplexer.cs
@@ -1,11 +1,11 @@
-using StackExchange.Redis.Maintenance;
-using StackExchange.Redis.Profiling;
-using System;
+using System;
using System.Collections.Concurrent;
using System.ComponentModel;
using System.IO;
using System.Net;
using System.Threading.Tasks;
+using StackExchange.Redis.Maintenance;
+using StackExchange.Redis.Profiling;
using static StackExchange.Redis.ConnectionMultiplexer;
namespace StackExchange.Redis
diff --git a/src/StackExchange.Redis/Interfaces/IDatabase.cs b/src/StackExchange.Redis/Interfaces/IDatabase.cs
index 7cf2248fd..6178051d0 100644
--- a/src/StackExchange.Redis/Interfaces/IDatabase.cs
+++ b/src/StackExchange.Redis/Interfaces/IDatabase.cs
@@ -6,12 +6,12 @@
namespace StackExchange.Redis
{
///
- /// Describes functionality that is common to both standalone redis servers and redis clusters
+ /// Describes functionality that is common to both standalone redis servers and redis clusters.
///
public interface IDatabase : IRedis, IDatabaseAsync
{
///
- /// The numeric identifier of this database
+ /// The numeric identifier of this database.
///
int Database { get; }
@@ -492,8 +492,9 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// if field is a new field in the hash and value was set, if field already exists in the hash and the value was updated.
///
+ /// See
/// ,
- ///
+ /// .
///
bool HashSet(RedisKey key, RedisValue hashField, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None);
@@ -501,7 +502,7 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// Returns the string length of the value associated with field in the hash stored at key.
///
/// The key of the hash.
- /// The field containing the string
+ /// The field containing the string.
/// The flags to use for this operation.
/// The length of the string at field, or 0 when key does not exist.
///
@@ -559,7 +560,7 @@ public interface IDatabase : IRedis, IDatabaseAsync
///
/// The key of the merged hyperloglog.
/// The key of the first hyperloglog to merge.
- /// The key of the first hyperloglog to merge.
+ /// The key of the second hyperloglog to merge.
/// The flags to use for this operation.
///
void HyperLogLogMerge(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags = CommandFlags.None);
@@ -601,8 +602,9 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// if the key was removed.
///
+ /// See
/// ,
- ///
+ /// .
///
bool KeyDelete(RedisKey key, CommandFlags flags = CommandFlags.None);
@@ -614,8 +616,9 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// The number of keys that were removed.
///
+ /// See
/// ,
- ///
+ /// .
///
long KeyDelete(RedisKey[] keys, CommandFlags flags = CommandFlags.None);
@@ -677,9 +680,10 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// See the page on key expiry for more information.
///
///
+ /// See
/// ,
/// ,
- ///
+ /// .
///
///
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
@@ -696,8 +700,9 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// if the timeout was set. if key does not exist or the timeout could not be set.
///
+ /// See
/// ,
- ///
+ /// .
///
bool KeyExpire(RedisKey key, TimeSpan? expiry, ExpireWhen when = ExpireWhen.Always, CommandFlags flags = CommandFlags.None);
@@ -722,9 +727,10 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// See the page on key expiry for more information.
///
///
+ /// See
/// ,
/// ,
- ///
+ /// .
///
///
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
@@ -741,8 +747,9 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// if the timeout was set. if key does not exist or the timeout could not be set.
///
+ /// See
/// ,
- ///
+ /// .
///
bool KeyExpire(RedisKey key, DateTime? expiry, ExpireWhen when = ExpireWhen.Always, CommandFlags flags = CommandFlags.None);
@@ -753,8 +760,9 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// The time at which the given key will expire, or if the key does not exist or has no associated expiration time.
///
+ /// See
/// ,
- ///
+ /// .
///
DateTime? KeyExpireTime(RedisKey key, CommandFlags flags = CommandFlags.None);
@@ -826,8 +834,9 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// if the key was renamed, otherwise.
///
+ /// See
/// ,
- ///
+ /// .
///
bool KeyRename(RedisKey key, RedisKey newKey, When when = When.Always, CommandFlags flags = CommandFlags.None);
@@ -931,7 +940,7 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// If the list contains less than count elements, removes and returns the number of elements in the list.
///
/// The key of the list.
- /// The number of elements to remove
+ /// The number of elements to remove.
/// The flags to use for this operation.
/// Array of values that were popped, or if the key doesn't exist.
///
@@ -985,8 +994,9 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// The length of the list after the push operations.
///
+ /// See
/// ,
- ///
+ /// .
///
long ListLeftPush(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None);
@@ -1000,8 +1010,9 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// The length of the list after the push operations.
///
+ /// See
/// ,
- ///
+ /// .
///
long ListLeftPush(RedisKey key, RedisValue[] values, When when = When.Always, CommandFlags flags = CommandFlags.None);
@@ -1085,7 +1096,7 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// If the list contains less than count elements, removes and returns the number of elements in the list.
///
/// The key of the list.
- /// The number of elements to pop
+ /// The number of elements to pop.
/// The flags to use for this operation.
/// Array of values that were popped, or if the key doesn't exist.
///
@@ -1122,8 +1133,9 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// The length of the list after the push operation.
///
+ /// See
/// ,
- ///
+ /// .
///
long ListRightPush(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None);
@@ -1137,8 +1149,9 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// The length of the list after the push operation.
///
+ /// See
/// ,
- ///
+ /// .
///
long ListRightPush(RedisKey key, RedisValue[] values, When when = When.Always, CommandFlags flags = CommandFlags.None);
@@ -1260,8 +1273,9 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// A dynamic representation of the script's result.
///
+ /// See
/// ,
- ///
+ /// .
///
RedisResult ScriptEvaluate(string script, RedisKey[]? keys = null, RedisValue[]? values = null, CommandFlags flags = CommandFlags.None);
@@ -1312,8 +1326,9 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// A dynamic representation of the script's result.
///
+ /// See
/// ,
- ///
+ /// .
///
RedisResult ScriptEvaluateReadOnly(string script, RedisKey[]? keys = null, RedisValue[]? values = null, CommandFlags flags = CommandFlags.None);
@@ -1361,9 +1376,10 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// List with members of the resulting set.
///
+ /// See
/// ,
/// ,
- ///
+ /// .
///
RedisValue[] SetCombine(SetOperation operation, RedisKey first, RedisKey second, CommandFlags flags = CommandFlags.None);
@@ -1375,9 +1391,10 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// List with members of the resulting set.
///
+ /// See
/// ,
/// ,
- ///
+ /// .
///
RedisValue[] SetCombine(SetOperation operation, RedisKey[] keys, CommandFlags flags = CommandFlags.None);
@@ -1392,9 +1409,10 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// The number of elements in the resulting set.
///
+ /// See
/// ,
/// ,
- ///
+ /// .
///
long SetCombineAndStore(SetOperation operation, RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags = CommandFlags.None);
@@ -1408,9 +1426,10 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// The number of elements in the resulting set.
///
+ /// See
/// ,
/// ,
- ///
+ /// .
///
long SetCombineAndStore(SetOperation operation, RedisKey destination, RedisKey[] keys, CommandFlags flags = CommandFlags.None);
@@ -1565,7 +1584,7 @@ public interface IDatabase : IRedis, IDatabaseAsync
///
/// The SSCAN command is used to incrementally iterate over set.
- /// Note: to resume an iteration via cursor, cast the original enumerable or enumerator to .
+ /// Note: to resume an iteration via cursor, cast the original enumerable or enumerator to .
///
/// The key of the set.
/// The pattern to match.
@@ -1596,8 +1615,9 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// The sorted elements, or the external values if get is specified.
///
+ /// See
/// ,
- ///
+ /// .
///
RedisValue[] Sort(RedisKey key, long skip = 0, long take = -1, Order order = Order.Ascending, SortType sortType = SortType.Numeric, RedisValue by = default, RedisValue[]? get = null, CommandFlags flags = CommandFlags.None);
@@ -1628,7 +1648,7 @@ public interface IDatabase : IRedis, IDatabaseAsync
///
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
- bool SortedSetAdd(RedisKey key, RedisValue member, double score, When when, CommandFlags flags= CommandFlags.None);
+ bool SortedSetAdd(RedisKey key, RedisValue member, double score, When when, CommandFlags flags = CommandFlags.None);
///
/// Adds the specified member with the specified score to the sorted set stored at key.
@@ -1675,9 +1695,10 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// The resulting sorted set.
///
+ /// See
/// ,
/// ,
- ///
+ /// .
///
RedisValue[] SortedSetCombine(SetOperation operation, RedisKey[] keys, double[]? weights = null, Aggregate aggregate = Aggregate.Sum, CommandFlags flags = CommandFlags.None);
@@ -1693,9 +1714,10 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// The resulting sorted set with scores.
///
+ /// See
/// ,
/// ,
- ///
+ /// .
///
SortedSetEntry[] SortedSetCombineWithScores(SetOperation operation, RedisKey[] keys, double[]? weights = null, Aggregate aggregate = Aggregate.Sum, CommandFlags flags = CommandFlags.None);
@@ -1712,9 +1734,10 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// The number of elements in the resulting sorted set at destination.
///
+ /// See
/// ,
/// ,
- ///
+ /// .
///
long SortedSetCombineAndStore(SetOperation operation, RedisKey destination, RedisKey first, RedisKey second, Aggregate aggregate = Aggregate.Sum, CommandFlags flags = CommandFlags.None);
@@ -1731,9 +1754,10 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// The number of elements in the resulting sorted set at destination.
///
+ /// See
/// ,
/// ,
- ///
+ /// .
///
long SortedSetCombineAndStore(SetOperation operation, RedisKey destination, RedisKey[] keys, double[]? weights = null, Aggregate aggregate = Aggregate.Sum, CommandFlags flags = CommandFlags.None);
@@ -1856,8 +1880,9 @@ public interface IDatabase : IRedis, IDatabaseAsync
/// The flags to use for this operation.
/// List of elements in the specified range.
///
+ /// See
/// ,
- ///
+ /// .
///
RedisValue[] SortedSetRangeByRank(RedisKey key, long start = 0, long stop = -1, Order order = Order.Ascending, CommandFlags flags = CommandFlags.None);
@@ -1907,8 +1932,9 @@ long SortedSetRangeAndStore(
/// The flags to use for this operation.
/// List of elements in the specified range.
///
+ /// See
/// ,
- ///
+ /// .
///
SortedSetEntry[] SortedSetRangeByRankWithScores(RedisKey key, long start = 0, long stop = -1, Order order = Order.Ascending, CommandFlags flags = CommandFlags.None);
@@ -1929,10 +1955,12 @@ long SortedSetRangeAndStore(
/// The flags to use for this operation.
/// List of elements in the specified score range.
///
+ /// See
/// ,
- ///
+ /// .
///
- RedisValue[] SortedSetRangeByScore(RedisKey key,
+ RedisValue[] SortedSetRangeByScore(
+ RedisKey key,
double start = double.NegativeInfinity,
double stop = double.PositiveInfinity,
Exclude exclude = Exclude.None,
@@ -1958,10 +1986,12 @@ RedisValue[] SortedSetRangeByScore(RedisKey key,
/// The flags to use for this operation.
/// List of elements in the specified score range.
///
+ /// See
/// ,
- ///
+ /// .
///
- SortedSetEntry[] SortedSetRangeByScoreWithScores(RedisKey key,
+ SortedSetEntry[] SortedSetRangeByScoreWithScores(
+ RedisKey key,
double start = double.NegativeInfinity,
double stop = double.PositiveInfinity,
Exclude exclude = Exclude.None,
@@ -1983,7 +2013,8 @@ SortedSetEntry[] SortedSetRangeByScoreWithScores(RedisKey key,
/// The flags to use for this operation.
/// List of elements in the specified score range.
///
- RedisValue[] SortedSetRangeByValue(RedisKey key,
+ RedisValue[] SortedSetRangeByValue(
+ RedisKey key,
RedisValue min,
RedisValue max,
Exclude exclude,
@@ -1999,16 +2030,18 @@ RedisValue[] SortedSetRangeByValue(RedisKey key,
/// The min value to filter by.
/// The max value to filter by.
/// Which of and to exclude (defaults to both inclusive).
- /// Whether to order the data ascending or descending
+ /// Whether to order the data ascending or descending.
/// How many items to skip.
/// How many items to take.
/// The flags to use for this operation.
/// List of elements in the specified score range.
///
+ /// See
/// ,
- ///
+ /// .
///
- RedisValue[] SortedSetRangeByValue(RedisKey key,
+ RedisValue[] SortedSetRangeByValue(
+ RedisKey key,
RedisValue min = default,
RedisValue max = default,
Exclude exclude = Exclude.None,
@@ -2027,8 +2060,9 @@ RedisValue[] SortedSetRangeByValue(RedisKey key,
/// The flags to use for this operation.
/// If member exists in the sorted set, the rank of member. If member does not exist in the sorted set or key does not exist, .
///
+ /// See
/// ,
- ///
+ /// .
///
long? SortedSetRank(RedisKey key, RedisValue member, Order order = Order.Ascending, CommandFlags flags = CommandFlags.None);
@@ -2104,7 +2138,7 @@ RedisValue[] SortedSetRangeByValue(RedisKey key,
///
/// The ZSCAN command is used to incrementally iterate over a sorted set
- /// Note: to resume an iteration via cursor, cast the original enumerable or enumerator to IScanningCursor.
+ /// Note: to resume an iteration via cursor, cast the original enumerable or enumerator to IScanningCursor.
///
/// The key of the sorted set.
/// The pattern to match.
@@ -2114,7 +2148,8 @@ RedisValue[] SortedSetRangeByValue(RedisKey key,
/// The flags to use for this operation.
/// Yields all matching elements of the sorted set.
///
- IEnumerable SortedSetScan(RedisKey key,
+ IEnumerable SortedSetScan(
+ RedisKey key,
RedisValue pattern = default,
int pageSize = RedisBase.CursorUtils.DefaultLibraryPageSize,
long cursor = RedisBase.CursorUtils.Origin,
@@ -2154,8 +2189,9 @@ IEnumerable SortedSetScan(RedisKey key,
/// The flags to use for this operation.
/// The removed element, or when key does not exist.
///
+ /// See
/// ,
- ///
+ /// .
///
SortedSetEntry? SortedSetPop(RedisKey key, Order order = Order.Ascending, CommandFlags flags = CommandFlags.None);
@@ -2168,8 +2204,9 @@ IEnumerable SortedSetScan(RedisKey key,
/// The flags to use for this operation.
/// An array of elements, or an empty array when key does not exist.
///
+ /// See
/// ,
- ///
+ /// .
///
SortedSetEntry[] SortedSetPop(RedisKey key, long count, Order order = Order.Ascending, CommandFlags flags = CommandFlags.None);
@@ -2428,7 +2465,7 @@ IEnumerable SortedSetScan(RedisKey key,
/// A pending message is a message read using StreamReadGroup (XREADGROUP) but not yet acknowledged.
///
/// The key of the stream.
- /// The name of the consumer group
+ /// The name of the consumer group.
/// The flags to use for this operation.
///
/// An instance of .
@@ -2527,7 +2564,7 @@ IEnumerable SortedSetScan(RedisKey key,
///
/// Array of streams and the positions from which to begin reading for each stream.
/// The name of the consumer group.
- ///
+ /// The name of the consumer.
/// The maximum number of messages to return from each stream.
/// The flags to use for this operation.
/// A value of for each stream.
@@ -2543,7 +2580,7 @@ IEnumerable SortedSetScan(RedisKey key,
///
/// Array of streams and the positions from which to begin reading for each stream.
/// The name of the consumer group.
- ///
+ /// The name of the consumer.
/// The maximum number of messages to return from each stream.
/// When true, the message will not be added to the pending message list.
/// The flags to use for this operation.
@@ -2657,8 +2694,9 @@ IEnumerable SortedSetScan(RedisKey key,
/// The flags to use for this operation.
/// The value of key after the decrement.
///
+ /// See
/// ,
- ///
+ /// .
///
long StringDecrement(RedisKey key, long value = 1, CommandFlags flags = CommandFlags.None);
@@ -2793,8 +2831,9 @@ IEnumerable SortedSetScan(RedisKey key,
/// The flags to use for this operation.
/// The value of key after the increment.
///
+ /// See
/// ,
- ///
+ /// .
///
long StringIncrement(RedisKey key, long value = 1, CommandFlags flags = CommandFlags.None);
@@ -2889,8 +2928,9 @@ IEnumerable SortedSetScan(RedisKey key,
/// The flags to use for this operation.
/// if the keys were set, otherwise.
///
+ /// See
/// ,
- ///
+ /// .
///
bool StringSet(KeyValuePair[] values, When when = When.Always, CommandFlags flags = CommandFlags.None);
diff --git a/src/StackExchange.Redis/Interfaces/IDatabaseAsync.cs b/src/StackExchange.Redis/Interfaces/IDatabaseAsync.cs
index a19525925..103b7151b 100644
--- a/src/StackExchange.Redis/Interfaces/IDatabaseAsync.cs
+++ b/src/StackExchange.Redis/Interfaces/IDatabaseAsync.cs
@@ -18,1834 +18,452 @@ public interface IDatabaseAsync : IRedisAsync
/// The flags to use for this operation.
bool IsConnected(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Atomically transfer a key from a source Redis instance to a destination Redis instance.
- /// On success the key is deleted from the original instance by default, and is guaranteed to exist in the target instance.
- ///
- /// The key to migrate.
- /// The server to migrate the key to.
- /// The database to migrate the key to.
- /// The timeout to use for the transfer.
- /// The options to use for this migration.
- /// The flags to use for this operation.
- ///
+ ///
Task KeyMigrateAsync(RedisKey key, EndPoint toServer, int toDatabase = 0, int timeoutMilliseconds = 0, MigrateOptions migrateOptions = MigrateOptions.None, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the raw DEBUG OBJECT output for a key.
- /// This command is not fully documented and should be avoided unless you have good reason, and then avoided anyway.
- ///
- /// The key to debug.
- /// The flags to use for this migration.
- /// The raw output from DEBUG OBJECT.
- ///
+ /// "
Task DebugObjectAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Add the specified member to the set stored at key.
- /// Specified members that are already a member of this set are ignored.
- /// If key does not exist, a new set is created before adding the specified members.
- ///
- /// The key of the set.
- /// The longitude of geo entry.
- /// The latitude of the geo entry.
- /// The value to set at this entry.
- /// The flags to use for this operation.
- /// if the specified member was not already present in the set, else .
- ///
+ ///
Task GeoAddAsync(RedisKey key, double longitude, double latitude, RedisValue member, CommandFlags flags = CommandFlags.None);
- ///
- /// Add the specified member to the set stored at key.
- /// Specified members that are already a member of this set are ignored.
- /// If key does not exist, a new set is created before adding the specified members.
- ///
- /// The key of the set.
- /// The geo value to store.
- /// The flags to use for this operation.
- /// if the specified member was not already present in the set, else .
- ///
+ ///
Task GeoAddAsync(RedisKey key, GeoEntry value, CommandFlags flags = CommandFlags.None);
- ///
- /// Add the specified members to the set stored at key.
- /// Specified members that are already a member of this set are ignored.
- /// If key does not exist, a new set is created before adding the specified members.
- ///
- /// The key of the set.
- /// The geo values add to the set.
- /// The flags to use for this operation.
- /// The number of elements that were added to the set, not including all the elements already present into the set.
- ///
+ ///
Task GeoAddAsync(RedisKey key, GeoEntry[] values, CommandFlags flags = CommandFlags.None);
- ///
- /// Removes the specified member from the geo sorted set stored at key.
- /// Non existing members are ignored.
- ///
- /// The key of the set.
- /// The geo value to remove.
- /// The flags to use for this operation.
- /// if the member existed in the sorted set and was removed, else .
- ///
+ ///
Task GeoRemoveAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
- ///
- /// Return the distance between two members in the geospatial index represented by the sorted set.
- ///
- /// The key of the set.
- /// The first member to check.
- /// The second member to check.
- /// The unit of distance to return (defaults to meters).
- /// The flags to use for this operation.
- /// The command returns the distance as a double (represented as a string) in the specified unit, or if one or both the elements are missing.
- ///
+ ///
Task GeoDistanceAsync(RedisKey key, RedisValue member1, RedisValue member2, GeoUnit unit = GeoUnit.Meters, CommandFlags flags = CommandFlags.None);
- ///
- /// Return valid Geohash strings representing the position of one or more elements in a sorted set value representing a geospatial index (where elements were added using GEOADD).
- ///
- /// The key of the set.
- /// The members to get.
- /// The flags to use for this operation.
- /// The command returns an array where each element is the Geohash corresponding to each member name passed as argument to the command.
- ///
+ ///
Task GeoHashAsync(RedisKey key, RedisValue[] members, CommandFlags flags = CommandFlags.None);
- ///
- /// Return valid Geohash strings representing the position of one or more elements in a sorted set value representing a geospatial index (where elements were added using GEOADD).
- ///
- /// The key of the set.
- /// The member to get.
- /// The flags to use for this operation.
- /// The command returns an array where each element is the Geohash corresponding to each member name passed as argument to the command.
- ///
+ ///
Task GeoHashAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
- ///
- /// Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.
- ///
- /// The key of the set.
- /// The members to get.
- /// The flags to use for this operation.
- ///
- /// The command returns an array where each element is a two elements array representing longitude and latitude (x,y) of each member name passed as argument to the command.
- /// Non existing elements are reported as NULL elements of the array.
- ///
- ///
+ ///
Task GeoPositionAsync(RedisKey key, RedisValue[] members, CommandFlags flags = CommandFlags.None);
- ///
- /// Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.
- ///
- /// The key of the set.
- /// The member to get.
- /// The flags to use for this operation.
- ///
- /// The command returns an array where each element is a two elements array representing longitude and latitude (x,y) of each member name passed as argument to the command.
- /// Non existing elements are reported as NULL elements of the array.
- ///
- ///
+ ///
Task GeoPositionAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
- ///
- /// Return the members of a sorted set populated with geospatial information using GEOADD, which are
- /// within the borders of the area specified with the center location and the maximum distance from the center (the radius).
- ///
- /// The key of the set.
- /// The member to get a radius of results from.
- /// The radius to check.
- /// The unit of (defaults to meters).
- /// The count of results to get, -1 for unlimited.
- /// The order of the results.
- /// The search options to use.
- /// The flags to use for this operation.
- /// The results found within the radius, if any.
- ///
+ ///
Task GeoRadiusAsync(RedisKey key, RedisValue member, double radius, GeoUnit unit = GeoUnit.Meters, int count = -1, Order? order = null, GeoRadiusOptions options = GeoRadiusOptions.Default, CommandFlags flags = CommandFlags.None);
- ///
- /// Return the members of a sorted set populated with geospatial information using GEOADD, which are
- /// within the borders of the area specified with the center location and the maximum distance from the center (the radius).
- ///
- /// The key of the set.
- /// The longitude of the point to get a radius of results from.
- /// The latitude of the point to get a radius of results from.
- /// The radius to check.
- /// The unit of (defaults to meters).
- /// The count of results to get, -1 for unlimited.
- /// The order of the results.
- /// The search options to use.
- /// The flags to use for this operation.
- /// The results found within the radius, if any.
- ///
+ ///
Task GeoRadiusAsync(RedisKey key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.Meters, int count = -1, Order? order = null, GeoRadiusOptions options = GeoRadiusOptions.Default, CommandFlags flags = CommandFlags.None);
- ///
- /// Return the members of the geo-encoded sorted set stored at bounded by the provided
- /// , centered at the provided set .
- ///
- /// The key of the set.
- /// The set member to use as the center of the shape.
- /// The shape to use to bound the geo search.
- /// The maximum number of results to pull back.
- /// Whether or not to terminate the search after finding results. Must be true of count is -1.
- /// The order to sort by (defaults to unordered).
- /// The search options to use.
- /// The flags for this operation.
- /// The results found within the shape, if any.
- ///
+ ///
Task GeoSearchAsync(RedisKey key, RedisValue member, GeoSearchShape shape, int count = -1, bool demandClosest = true, Order? order = null, GeoRadiusOptions options = GeoRadiusOptions.Default, CommandFlags flags = CommandFlags.None);
- ///
- /// Return the members of the geo-encoded sorted set stored at bounded by the provided
- /// , centered at the point provided by the and .
- ///
- /// The key of the set.
- /// The longitude of the center point.
- /// The latitude of the center point.
- /// The shape to use to bound the geo search.
- /// The maximum number of results to pull back.
- /// Whether or not to terminate the search after finding results. Must be true of count is -1.
- /// The order to sort by (defaults to unordered).
- /// The search options to use.
- /// The flags for this operation.
- /// The results found within the shape, if any.
- ///
+ ///
Task GeoSearchAsync(RedisKey key, double longitude, double latitude, GeoSearchShape shape, int count = -1, bool demandClosest = true, Order? order = null, GeoRadiusOptions options = GeoRadiusOptions.Default, CommandFlags flags = CommandFlags.None);
- ///
- /// Stores the members of the geo-encoded sorted set stored at bounded by the provided
- /// , centered at the provided set .
- ///
- /// The key of the set.
- /// The key to store the result at.
- /// The set member to use as the center of the shape.
- /// The shape to use to bound the geo search.
- /// The maximum number of results to pull back.
- /// Whether or not to terminate the search after finding results. Must be true of count is -1.
- /// The order to sort by (defaults to unordered).
- /// If set to true, the resulting set will be a regular sorted-set containing only distances, rather than a geo-encoded sorted-set.
- /// The flags for this operation.
- /// The size of the set stored at .
- ///
+ ///
Task GeoSearchAndStoreAsync(RedisKey sourceKey, RedisKey destinationKey, RedisValue member, GeoSearchShape shape, int count = -1, bool demandClosest = true, Order? order = null, bool storeDistances = false, CommandFlags flags = CommandFlags.None);
- ///
- /// Stores the members of the geo-encoded sorted set stored at bounded by the provided
- /// , centered at the point provided by the and .
- ///
- /// The key of the set.
- /// The key to store the result at.
- /// The longitude of the center point.
- /// The latitude of the center point.
- /// The shape to use to bound the geo search.
- /// The maximum number of results to pull back.
- /// Whether or not to terminate the search after finding results. Must be true of count is -1.
- /// The order to sort by (defaults to unordered).
- /// If set to true, the resulting set will be a regular sorted-set containing only distances, rather than a geo-encoded sorted-set.
- /// The flags for this operation.
- /// The size of the set stored at .
- ///
+ ///
Task GeoSearchAndStoreAsync(RedisKey sourceKey, RedisKey destinationKey, double longitude, double latitude, GeoSearchShape shape, int count = -1, bool demandClosest = true, Order? order = null, bool storeDistances = false, CommandFlags flags = CommandFlags.None);
- ///
- /// Decrements the number stored at field in the hash stored at key by decrement.
- /// If key does not exist, a new key holding a hash is created.
- /// If field does not exist the value is set to 0 before the operation is performed.
- ///
- /// The key of the hash.
- /// The field in the hash to decrement.
- /// The amount to decrement by.
- /// The flags to use for this operation.
- /// The value at field after the decrement operation.
- ///
- /// The range of values supported by HINCRBY is limited to 64 bit signed integers.
- ///
- ///
+ ///
Task HashDecrementAsync(RedisKey key, RedisValue hashField, long value = 1, CommandFlags flags = CommandFlags.None);
- ///
- /// Decrement the specified field of an hash stored at key, and representing a floating point number, by the specified decrement.
- /// If the field does not exist, it is set to 0 before performing the operation.
- ///
- /// The key of the hash.
- /// The field in the hash to decrement.
- /// The amount to decrement by.
- /// The flags to use for this operation.
- /// The value at field after the decrement operation.
- ///
- /// The precision of the output is fixed at 17 digits after the decimal point regardless of the actual internal precision of the computation.
- ///
- ///
+ ///
Task HashDecrementAsync(RedisKey key, RedisValue hashField, double value, CommandFlags flags = CommandFlags.None);
- ///
- /// Removes the specified fields from the hash stored at key.
- /// Non-existing fields are ignored. Non-existing keys are treated as empty hashes and this command returns 0.
- ///
- /// The key of the hash.
- /// The field in the hash to delete.
- /// The flags to use for this operation.
- /// if the field was removed.
- ///
+ ///
Task HashDeleteAsync(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None);
- ///
- /// Removes the specified fields from the hash stored at key.
- /// Non-existing fields are ignored. Non-existing keys are treated as empty hashes and this command returns 0.
- ///
- /// The key of the hash.
- /// The fields in the hash to delete.
- /// The flags to use for this operation.
- /// The number of fields that were removed.
- ///
+ ///
Task HashDeleteAsync(RedisKey key, RedisValue[] hashFields, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns if field is an existing field in the hash stored at key.
- ///
- /// The key of the hash.
- /// The field in the hash to check.
- /// The flags to use for this operation.
- /// if the hash contains field, if the hash does not contain field, or key does not exist.
- ///
+ ///
Task HashExistsAsync(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the value associated with field in the hash stored at key.
- ///
- /// The key of the hash.
- /// The field in the hash to get.
- /// The flags to use for this operation.
- /// The value associated with field, or when field is not present in the hash or key does not exist.
- ///
+ ///
Task HashGetAsync(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the value associated with field in the hash stored at key.
- ///
- /// The key of the hash.
- /// The field in the hash to get.
- /// The flags to use for this operation.
- /// The value associated with field, or when field is not present in the hash or key does not exist.
- ///
+ ///
Task?> HashGetLeaseAsync(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the values associated with the specified fields in the hash stored at key.
- /// For every field that does not exist in the hash, a value is returned.
- /// Because a non-existing keys are treated as empty hashes, running HMGET against a non-existing key will return a list of values.
- ///
- /// The key of the hash.
- /// The fields in the hash to get.
- /// The flags to use for this operation.
- /// List of values associated with the given fields, in the same order as they are requested.
- ///
+ ///
Task HashGetAsync(RedisKey key, RedisValue[] hashFields, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns all fields and values of the hash stored at key.
- ///
- /// The key of the hash to get all entries from.
- /// The flags to use for this operation.
- /// List of fields and their values stored in the hash, or an empty list when key does not exist.
- ///
+ ///
Task HashGetAllAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Increments the number stored at field in the hash stored at key by increment.
- /// If key does not exist, a new key holding a hash is created.
- /// If field does not exist the value is set to 0 before the operation is performed.
- ///
- /// The key of the hash.
- /// The field in the hash to increment.
- /// The amount to increment by.
- /// The flags to use for this operation.
- /// The value at field after the increment operation.
- ///
- /// The range of values supported by HINCRBY is limited to 64 bit signed integers.
- ///
- ///
+ ///
Task HashIncrementAsync(RedisKey key, RedisValue hashField, long value = 1, CommandFlags flags = CommandFlags.None);
- ///
- /// Increment the specified field of an hash stored at key, and representing a floating point number, by the specified increment.
- /// If the field does not exist, it is set to 0 before performing the operation.
- ///
- /// The key of the hash.
- /// The field in the hash to increment.
- /// The amount to increment by.
- /// The flags to use for this operation.
- /// The value at field after the increment operation.
- ///
- /// The precision of the output is fixed at 17 digits after the decimal point regardless of the actual internal precision of the computation.
- ///
- ///
+ ///
Task HashIncrementAsync(RedisKey key, RedisValue hashField, double value, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns all field names in the hash stored at key.
- ///
- /// The key of the hash.
- /// The flags to use for this operation.
- /// List of fields in the hash, or an empty list when key does not exist.
- ///
+ ///
Task HashKeysAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the number of fields contained in the hash stored at key.
- ///
- /// The key of the hash.
- /// The flags to use for this operation.
- /// The number of fields in the hash, or 0 when key does not exist.
- ///
+ ///
Task HashLengthAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Gets a random field from the hash at .
- ///
- /// The key of the hash.
- /// The flags to use for this operation.
- /// A random hash field name or if the hash does not exist.
- ///
+ ///
Task HashRandomFieldAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Gets field names from the hash at .
- ///
- /// The key of the hash.
- /// The number of fields to return.
- /// The flags to use for this operation.
- /// An array of hash field names of size of at most , or if the hash does not exist.
- ///
+ ///
Task HashRandomFieldsAsync(RedisKey key, long count, CommandFlags flags = CommandFlags.None);
- ///
- /// Gets field names and values from the hash at .
- ///
- /// The key of the hash.
- /// The number of fields to return.
- /// The flags to use for this operation.
- /// An array of hash entries of size of at most , or if the hash does not exist.
- ///
+ ///
Task HashRandomFieldsWithValuesAsync(RedisKey key, long count, CommandFlags flags = CommandFlags.None);
- ///
- /// The HSCAN command is used to incrementally iterate over a hash.
- /// Note: to resume an iteration via cursor, cast the original enumerable or enumerator to .
- ///
- /// The key of the hash.
- /// The pattern of keys to get entries for.
- /// The page size to iterate by.
- /// The cursor position to start at.
- /// The page offset to start at.
- /// The flags to use for this operation.
- /// Yields all elements of the hash matching the pattern.
- ///
+ ///
IAsyncEnumerable HashScanAsync(RedisKey key, RedisValue pattern = default, int pageSize = RedisBase.CursorUtils.DefaultLibraryPageSize, long cursor = RedisBase.CursorUtils.Origin, int pageOffset = 0, CommandFlags flags = CommandFlags.None);
- ///
- /// Sets the specified fields to their respective values in the hash stored at key.
- /// This command overwrites any specified fields that already exist in the hash, leaving other unspecified fields untouched.
- /// If key does not exist, a new key holding a hash is created.
- ///
- /// The key of the hash.
- /// The entries to set in the hash.
- /// The flags to use for this operation.
- ///
+ ///
Task HashSetAsync(RedisKey key, HashEntry[] hashFields, CommandFlags flags = CommandFlags.None);
- ///
- /// Sets field in the hash stored at key to value.
- /// If key does not exist, a new key holding a hash is created.
- /// If field already exists in the hash, it is overwritten.
- ///
- /// The key of the hash.
- /// The field to set in the hash.
- /// The value to set.
- /// Which conditions under which to set the field value (defaults to always).
- /// The flags to use for this operation.
- /// if field is a new field in the hash and value was set, if field already exists in the hash and the value was updated.
- ///
- /// ,
- ///
- ///
+ ///
Task HashSetAsync(RedisKey key, RedisValue hashField, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the string length of the value associated with field in the hash stored at key.
- ///
- /// The key of the hash.
- /// The field containing the string
- /// The flags to use for this operation.
- /// The length of the string at field, or 0 when key does not exist.
- ///
+ ///
Task HashStringLengthAsync(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns all values in the hash stored at key.
- ///
- /// The key of the hash.
- /// The flags to use for this operation.
- /// List of values in the hash, or an empty list when key does not exist.
- ///
+ ///
Task HashValuesAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Adds the element to the HyperLogLog data structure stored at the variable name specified as first argument.
- ///
- /// The key of the hyperloglog.
- /// The value to add.
- /// The flags to use for this operation.
- /// if at least 1 HyperLogLog internal register was altered, otherwise.
- ///
+ ///
Task HyperLogLogAddAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None);
- ///
- /// Adds all the element arguments to the HyperLogLog data structure stored at the variable name specified as first argument.
- ///
- /// The key of the hyperloglog.
- /// The values to add.
- /// The flags to use for this operation.
- /// if at least 1 HyperLogLog internal register was altered, otherwise.
- ///
+ ///
Task HyperLogLogAddAsync(RedisKey key, RedisValue[] values, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the approximated cardinality computed by the HyperLogLog data structure stored at the specified variable, or 0 if the variable does not exist.
- ///
- /// The key of the hyperloglog.
- /// The flags to use for this operation.
- /// The approximated number of unique elements observed via HyperLogLogAdd.
- ///
+ ///
Task HyperLogLogLengthAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the approximated cardinality of the union of the HyperLogLogs passed, by internally merging the HyperLogLogs stored at the provided keys into a temporary hyperLogLog, or 0 if the variable does not exist.
- ///
- /// The keys of the hyperloglogs.
- /// The flags to use for this operation.
- /// The approximated number of unique elements observed via HyperLogLogAdd.
- ///
+ ///
Task HyperLogLogLengthAsync(RedisKey[] keys, CommandFlags flags = CommandFlags.None);
- ///
- /// Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures.
- ///
- /// The key of the merged hyperloglog.
- /// The key of the first hyperloglog to merge.
- /// The key of the first hyperloglog to merge.
- /// The flags to use for this operation.
- ///
+ ///
Task HyperLogLogMergeAsync(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags = CommandFlags.None);
- ///
- /// Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures.
- ///
- /// The key of the merged hyperloglog.
- /// The keys of the hyperloglogs to merge.
- /// The flags to use for this operation.
- ///
+ ///
Task HyperLogLogMergeAsync(RedisKey destination, RedisKey[] sourceKeys, CommandFlags flags = CommandFlags.None);
- ///
- /// Indicate exactly which redis server we are talking to.
- ///
- /// The key to check.
- /// The flags to use for this operation.
- /// The endpoint serving the key.
+ ///
Task IdentifyEndpointAsync(RedisKey key = default, CommandFlags flags = CommandFlags.None);
- ///
- /// Copies the value from the to the specified .
- ///
- /// The key of the source value to copy.
- /// The destination key to copy the source to.
- /// The database ID to store in. If default (-1), current database is used.
- /// Whether to overwrite an existing values at . If and the key exists, the copy will not succeed.
- /// The flags to use for this operation.
- /// if key was copied. if key was not copied.
- ///
+ ///
Task KeyCopyAsync(RedisKey sourceKey, RedisKey destinationKey, int destinationDatabase = -1, bool replace = false, CommandFlags flags = CommandFlags.None);
- ///
- /// Removes the specified key. A key is ignored if it does not exist.
- /// If UNLINK is available (Redis 4.0+), it will be used.
- ///
- /// The key to delete.
- /// The flags to use for this operation.
- /// if the key was removed.
- ///
- /// ,
- ///
- ///
+ ///
Task KeyDeleteAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Removes the specified keys. A key is ignored if it does not exist.
- /// If UNLINK is available (Redis 4.0+), it will be used.
- ///
- /// The keys to delete.
- /// The flags to use for this operation.
- /// The number of keys that were removed.
- ///
- /// ,
- ///
- ///
+ ///
Task KeyDeleteAsync(RedisKey[] keys, CommandFlags flags = CommandFlags.None);
- ///
- /// Serialize the value stored at key in a Redis-specific format and return it to the user.
- /// The returned value can be synthesized back into a Redis key using the RESTORE command.
- ///
- /// The key to dump.
- /// The flags to use for this operation.
- /// The serialized value.
- ///
+ ///
Task KeyDumpAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the internal encoding for the Redis object stored at .
- ///
- /// The key to dump.
- /// The flags to use for this operation.
- /// The Redis encoding for the value or is the key does not exist.
- ///
+ ///
Task KeyEncodingAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns if key exists.
- ///
- /// The key to check.
- /// The flags to use for this operation.
- /// if the key exists. if the key does not exist.
- ///
+ ///
Task KeyExistsAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Indicates how many of the supplied keys exists.
- ///
- /// The keys to check.
- /// The flags to use for this operation.
- /// The number of keys that existed.
- ///
+ ///
Task KeyExistsAsync(RedisKey[] keys, CommandFlags flags = CommandFlags.None);
- ///
- /// Set a timeout on .
- /// After the timeout has expired, the key will automatically be deleted.
- /// A key with an associated timeout is said to be volatile in Redis terminology.
- ///
- /// The key to set the expiration for.
- /// The timeout to set.
- /// The flags to use for this operation.
- /// if the timeout was set. if key does not exist or the timeout could not be set.
- ///
- /// If key is updated before the timeout has expired, then the timeout is removed as if the PERSIST command was invoked on key.
- ///
- /// For Redis versions < 2.1.3, existing timeouts cannot be overwritten.
- /// So, if key already has an associated timeout, it will do nothing and return 0.
- ///
- ///
- /// Since Redis 2.1.3, you can update the timeout of a key.
- /// It is also possible to remove the timeout using the PERSIST command.
- /// See the page on key expiry for more information.
- ///
- ///
- /// ,
- /// ,
- ///
- ///
- ///
+ ///
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
Task KeyExpireAsync(RedisKey key, TimeSpan? expiry, CommandFlags flags);
- ///
- /// Set a timeout on .
- /// After the timeout has expired, the key will automatically be deleted.
- /// A key with an associated timeout is said to be volatile in Redis terminology.
- ///
- /// The key to set the expiration for.
- /// The timeout to set.
- /// In Redis 7+, we choose under which condition the expiration will be set using .
- /// The flags to use for this operation.
- /// if the timeout was set. if key does not exist or the timeout could not be set.
- ///
- /// ,
- ///
- ///
+ ///
Task KeyExpireAsync(RedisKey key, TimeSpan? expiry, ExpireWhen when = ExpireWhen.Always, CommandFlags flags = CommandFlags.None);
- ///
- /// Set a timeout on .
- /// After the timeout has expired, the key will automatically be deleted.
- /// A key with an associated timeout is said to be volatile in Redis terminology.
- ///
- /// The key to set the expiration for.
- /// The exact date to expiry to set.
- /// The flags to use for this operation.
- /// if the timeout was set. if key does not exist or the timeout could not be set.
- ///
- /// If key is updated before the timeout has expired, then the timeout is removed as if the PERSIST command was invoked on key.
- ///
- /// For Redis versions < 2.1.3, existing timeouts cannot be overwritten.
- /// So, if key already has an associated timeout, it will do nothing and return 0.
- ///
- ///
- /// Since Redis 2.1.3, you can update the timeout of a key.
- /// It is also possible to remove the timeout using the PERSIST command.
- /// See the page on key expiry for more information.
- ///
- ///
- /// ,
- /// ,
- ///
- ///
- ///
+ ///
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
Task KeyExpireAsync(RedisKey key, DateTime? expiry, CommandFlags flags);
- ///
- /// Set a timeout on .
- /// After the timeout has expired, the key will automatically be deleted.
- /// A key with an associated timeout is said to be volatile in Redis terminology.
- ///
- /// The key to set the expiration for.
- /// The timeout to set.
- /// In Redis 7+, we choose under which condition the expiration will be set using .
- /// The flags to use for this operation.
- /// if the timeout was set. if key does not exist or the timeout could not be set.
- ///
- /// ,
- ///
- ///
+ ///
Task KeyExpireAsync(RedisKey key, DateTime? expiry, ExpireWhen when = ExpireWhen.Always, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the absolute time at which the given will expire, if it exists and has an expiration.
- ///
- /// The key to get the expiration for.
- /// The flags to use for this operation.
- /// The time at which the given key will expire, or if the key does not exist or has no associated expiration time.
- ///
- /// ,
- ///
- ///
+ ///
Task KeyExpireTimeAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the logarithmic access frequency counter of the object stored at .
- /// The command is only available when the maxmemory-policy configuration directive is set to
- /// one of the LFU policies.
- ///
- /// The key to get a frequency count for.
- /// The flags to use for this operation.
- /// The number of logarithmic access frequency counter, ( if the key does not exist).
- ///
+ ///
Task KeyFrequencyAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the time since the object stored at the specified key is idle (not requested by read or write operations).
- ///
- /// The key to get the time of.
- /// The flags to use for this operation.
- /// The time since the object stored at the specified key is idle.
- ///
+ ///
Task KeyIdleTimeAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Move key from the currently selected database (see SELECT) to the specified destination database.
- /// When key already exists in the destination database, or it does not exist in the source database, it does nothing.
- /// It is possible to use MOVE as a locking primitive because of this.
- ///
- /// The key to move.
- /// The database to move the key to.
- /// The flags to use for this operation.
- /// if key was moved. if key was not moved.
- ///
+ ///
Task KeyMoveAsync(RedisKey key, int database, CommandFlags flags = CommandFlags.None);
- ///
- /// Remove the existing timeout on key, turning the key from volatile (a key with an expire set) to persistent (a key that will never expire as no timeout is associated).
- ///
- /// The key to persist.
- /// The flags to use for this operation.
- /// if the timeout was removed. if key does not exist or does not have an associated timeout.
- ///
+ ///
Task KeyPersistAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Return a random key from the currently selected database.
- ///
- /// The flags to use for this operation.
- /// The random key, or when the database is empty.
- ///
+ ///
Task KeyRandomAsync(CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the reference count of the object stored at .
- ///
- /// The key to get a reference count for.
- /// The flags to use for this operation.
- /// The number of references ( if the key does not exist).
- ///
+ ///
Task KeyRefCountAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Renames to .
- /// It returns an error when the source and destination names are the same, or when key does not exist.
- ///
- /// The key to rename.
- /// The key to rename to.
- /// What conditions to rename under (defaults to always).
- /// The flags to use for this operation.
- /// if the key was renamed, otherwise.
- ///
- /// ,
- ///
- ///
+ ///
Task KeyRenameAsync(RedisKey key, RedisKey newKey, When when = When.Always, CommandFlags flags = CommandFlags.None);
- ///
- /// Create a key associated with a value that is obtained by deserializing the provided serialized value (obtained via DUMP).
- /// If is 0 the key is created without any expire, otherwise the specified expire time (in milliseconds) is set.
- ///
- /// The key to restore.
- /// The value of the key.
- /// The expiry to set.
- /// The flags to use for this operation.
- ///
+ ///
Task KeyRestoreAsync(RedisKey key, byte[] value, TimeSpan? expiry = null, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the remaining time to live of a key that has a timeout.
- /// This introspection capability allows a Redis client to check how many seconds a given key will continue to be part of the dataset.
- ///
- /// The key to check.
- /// The flags to use for this operation.
- /// TTL, or when key does not exist or does not have a timeout.
- ///
+ ///
Task KeyTimeToLiveAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Alters the last access time of a key.
- ///
- /// The key to touch.
- /// The flags to use for this operation.
- /// if the key was touched, otherwise.
- ///
+ ///
Task KeyTouchAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Alters the last access time of the specified . A key is ignored if it does not exist.
- ///
- /// The keys to touch.
- /// The flags to use for this operation.
- /// The number of keys that were touched.
- ///
+ ///
Task KeyTouchAsync(RedisKey[] keys, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the string representation of the type of the value stored at key.
- /// The different types that can be returned are: string, list, set, zset and hash.
- ///
- /// The key to get the type of.
- /// The flags to use for this operation.
- /// Type of key, or none when key does not exist.
- ///
+ ///
Task KeyTypeAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the element at index in the list stored at key.
- /// The index is zero-based, so 0 means the first element, 1 the second element and so on.
- /// Negative indices can be used to designate elements starting at the tail of the list.
- /// Here, -1 means the last element, -2 means the penultimate and so forth.
- ///
- /// The key of the list.
- /// The index position to get the value at.
- /// The flags to use for this operation.
- /// The requested element, or when index is out of range.
- ///
+ ///
Task ListGetByIndexAsync(RedisKey key, long index, CommandFlags flags = CommandFlags.None);
- ///
- /// Inserts value in the list stored at key either before or after the reference value pivot.
- /// When key does not exist, it is considered an empty list and no operation is performed.
- ///
- /// The key of the list.
- /// The value to insert after.
- /// The value to insert.
- /// The flags to use for this operation.
- /// The length of the list after the insert operation, or -1 when the value pivot was not found.
- ///
+ ///
Task ListInsertAfterAsync(RedisKey key, RedisValue pivot, RedisValue value, CommandFlags flags = CommandFlags.None);
- ///
- /// Inserts value in the list stored at key either before or after the reference value pivot.
- /// When key does not exist, it is considered an empty list and no operation is performed.
- ///
- /// The key of the list.
- /// The value to insert before.
- /// The value to insert.
- /// The flags to use for this operation.
- /// The length of the list after the insert operation, or -1 when the value pivot was not found.
- ///
+ ///
Task ListInsertBeforeAsync(RedisKey key, RedisValue pivot, RedisValue value, CommandFlags flags = CommandFlags.None);
- ///
- /// Removes and returns the first element of the list stored at key.
- ///
- /// The key of the list.
- /// The flags to use for this operation.
- /// The value of the first element, or when key does not exist.
- ///
+ ///
Task ListLeftPopAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Removes and returns count elements from the head of the list stored at key.
- /// If the list contains less than count elements, removes and returns the number of elements in the list.
- ///
- /// The key of the list.
- /// The number of elements to remove
- /// The flags to use for this operation.
- /// Array of values that were popped, or if the key doesn't exist.
- ///
+ ///
Task ListLeftPopAsync(RedisKey key, long count, CommandFlags flags = CommandFlags.None);
- ///
- /// Removes and returns at most elements from the first non-empty list in .
- /// Starts on the left side of the list.
- ///
- /// The keys to look through for elements to pop.
- /// The maximum number of elements to pop from the list.
- /// The flags to use for this operation.
- /// A span of contiguous elements from the list, or if no non-empty lists are found.
- ///
+ ///
Task ListLeftPopAsync(RedisKey[] keys, long count, CommandFlags flags = CommandFlags.None);
- ///
- /// Scans through the list stored at looking for , returning the 0-based
- /// index of the first matching element.
- ///
- /// The key of the list.
- /// The element to search for.
- /// The rank of the first element to return, within the sub-list of matching indexes in the case of multiple matches.
- /// The maximum number of elements to scan through before stopping, defaults to 0 (a full scan of the list.)
- /// The flags to use for this operation.
- /// The 0-based index of the first matching element, or -1 if not found.
- ///
+ ///
Task ListPositionAsync(RedisKey key, RedisValue element, long rank = 1, long maxLength = 0, CommandFlags flags = CommandFlags.None);
- ///
- /// Scans through the list stored at looking for instances of , returning the 0-based
- /// indexes of any matching elements.
- ///
- /// The key of the list.
- /// The element to search for.
- /// The number of matches to find. A count of 0 will return the indexes of all occurrences of the element.
- /// The rank of the first element to return, within the sub-list of matching indexes in the case of multiple matches.
- /// The maximum number of elements to scan through before stopping, defaults to 0 (a full scan of the list.)
- /// The flags to use for this operation.
- /// An array of at most of indexes of matching elements. If none are found, and empty array is returned.
- ///
+ ///
Task ListPositionsAsync(RedisKey key, RedisValue element, long count, long rank = 1, long maxLength = 0, CommandFlags flags = CommandFlags.None);
- ///
- /// Insert the specified value at the head of the list stored at key.
- /// If key does not exist, it is created as empty list before performing the push operations.
- ///
- /// The key of the list.
- /// The value to add to the head of the list.
- /// Which conditions to add to the list under (defaults to always).
- /// The flags to use for this operation.
- /// The length of the list after the push operations.
- ///
- /// ,
- ///
- ///
+ ///
Task ListLeftPushAsync(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None);
- ///
- /// Insert the specified value at the head of the list stored at key.
- /// If key does not exist, it is created as empty list before performing the push operations.
- ///
- /// The key of the list.
- /// The value to add to the head of the list.
- /// Which conditions to add to the list under (defaults to always).
- /// The flags to use for this operation.
- /// The length of the list after the push operations.
- ///
- /// ,
- ///
- ///
+ ///
Task ListLeftPushAsync(RedisKey key, RedisValue[] values, When when = When.Always, CommandFlags flags = CommandFlags.None);
- ///
- /// Insert all the specified values at the head of the list stored at key.
- /// If key does not exist, it is created as empty list before performing the push operations.
- /// Elements are inserted one after the other to the head of the list, from the leftmost element to the rightmost element.
- /// So for instance the command LPUSH mylist a b c will result into a list containing c as first element, b as second element and a as third element.
- ///
- /// The key of the list.
- /// The values to add to the head of the list.
- /// The flags to use for this operation.
- /// The length of the list after the push operations.
- ///
+ ///
Task ListLeftPushAsync(RedisKey key, RedisValue[] values, CommandFlags flags);
- ///
- /// Returns the length of the list stored at key. If key does not exist, it is interpreted as an empty list and 0 is returned.
- ///
- /// The key of the list.
- /// The flags to use for this operation.
- /// The length of the list at key.
- ///
+ ///
Task ListLengthAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns and removes the first or last element of the list stored at , and pushes the element
- /// as the first or last element of the list stored at .
- ///
- /// The key of the list to remove from.
- /// The key of the list to move to.
- /// What side of the list to remove from.
- /// What side of the list to move to.
- /// The flags to use for this operation.
- /// The element being popped and pushed or if there is no element to move.
- ///
+ ///
Task ListMoveAsync(RedisKey sourceKey, RedisKey destinationKey, ListSide sourceSide, ListSide destinationSide, CommandFlags flags = CommandFlags.None);
- ///
- /// Returns the specified elements of the list stored at key.
- /// The offsets start and stop are zero-based indexes, with 0 being the first element of the list (the head of the list), 1 being the next element and so on.
- /// These offsets can also be negative numbers indicating offsets starting at the end of the list.For example, -1 is the last element of the list, -2 the penultimate, and so on.
- /// Note that if you have a list of numbers from 0 to 100, LRANGE list 0 10 will return 11 elements, that is, the rightmost item is included.
- ///
- /// The key of the list.
- /// The start index of the list.
- /// The stop index of the list.
- /// The flags to use for this operation.
- /// List of elements in the specified range.
- ///
+ ///
Task ListRangeAsync(RedisKey key, long start = 0, long stop = -1, CommandFlags flags = CommandFlags.None);
- ///
- /// Removes the first count occurrences of elements equal to value from the list stored at key.
- /// The count argument influences the operation in the following ways:
- ///
- /// count > 0: Remove elements equal to value moving from head to tail.
- /// count < 0: Remove elements equal to value moving from tail to head.
- /// count = 0: Remove all elements equal to value.
- ///
- ///
- /// The key of the list.
- /// The value to remove from the list.
- /// The count behavior (see method summary).
- /// The flags to use for this operation.
- /// The number of removed elements.
- ///
+ ///
Task ListRemoveAsync(RedisKey key, RedisValue value, long count = 0, CommandFlags flags = CommandFlags.None);
- ///
- /// Removes and returns the last element of the list stored at key.
- ///
- /// The key of the list.
- /// The flags to use for this operation.
- /// The element being popped, or when key does not exist..
- ///
+ ///
Task ListRightPopAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Removes and returns count elements from the end the list stored at key.
- /// If the list contains less than count elements, removes and returns the number of elements in the list.
- ///
- /// The key of the list.
- /// The number of elements to pop
- /// The flags to use for this operation.
- /// Array of values that were popped, or if the key doesn't exist.
- ///
+ ///
Task ListRightPopAsync(RedisKey key, long count, CommandFlags flags = CommandFlags.None);
- ///
- /// Removes and returns at most elements from the first non-empty list in .
- /// Starts on the right side of the list.
- ///
- /// The keys to look through for elements to pop.
- /// The maximum number of elements to pop from the list.
- /// The flags to use for this operation.
- /// A span of contiguous elements from the list, or if no non-empty lists are found.
- ///
+ ///
Task ListRightPopAsync(RedisKey[] keys, long count, CommandFlags flags = CommandFlags.None);
- ///
- /// Atomically returns and removes the last element (tail) of the list stored at source, and pushes the element at the first element (head) of the list stored at destination.
- ///
- /// The key of the source list.
- /// The key of the destination list.
- /// The flags to use for this operation.
- /// The element being popped and pushed.
- ///
+ ///
Task ListRightPopLeftPushAsync(RedisKey source, RedisKey destination, CommandFlags flags = CommandFlags.None);
- ///
- /// Insert the specified value at the tail of the list stored at key.
- /// If key does not exist, it is created as empty list before performing the push operation.
- ///
- /// The key of the list.
- /// The value to add to the tail of the list.
- /// Which conditions to add to the list under.
- /// The flags to use for this operation.
- /// The length of the list after the push operation.
- ///
- /// ,
- ///
- ///
+ ///
Task ListRightPushAsync(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None);
- ///
- /// Insert the specified value at the tail of the list stored at key.
- /// If key does not exist, it is created as empty list before performing the push operation.
- ///
- /// The key of the list.
- /// The values to add to the tail of the list.
- /// Which conditions to add to the list under.
- /// The flags to use for this operation.
- /// The length of the list after the push operation.
- ///
- /// ,
- ///
- ///
+ ///
Task ListRightPushAsync(RedisKey key, RedisValue[] values, When when = When.Always, CommandFlags flags = CommandFlags.None);
- ///
- /// Insert all the specified values at the tail of the list stored at key.
- /// If key does not exist, it is created as empty list before performing the push operation.
- /// Elements are inserted one after the other to the tail of the list, from the leftmost element to the rightmost element.
- /// So for instance the command RPUSH mylist a b c will result into a list containing a as first element, b as second element and c as third element.
- ///
- /// The key of the list.
- /// The values to add to the tail of the list.
- /// The flags to use for this operation.
- /// The length of the list after the push operation.
- ///
+ ///
Task ListRightPushAsync(RedisKey key, RedisValue[] values, CommandFlags flags);
- ///
- /// Sets the list element at index to value.
- /// For more information on the index argument, see .
- /// An error is returned for out of range indexes.
- ///
- /// The key of the list.
- /// The index to set the value at.
- /// The values to add to the list.
- /// The flags to use for this operation.
- ///
+ ///
Task ListSetByIndexAsync(RedisKey key, long index, RedisValue value, CommandFlags flags = CommandFlags.None);
- ///
- /// Trim an existing list so that it will contain only the specified range of elements specified.
- /// Both start and stop are zero-based indexes, where 0 is the first element of the list (the head), 1 the next element and so on.
- /// For example: LTRIM foobar 0 2 will modify the list stored at foobar so that only the first three elements of the list will remain.
- /// start and end can also be negative numbers indicating offsets from the end of the list, where -1 is the last element of the list, -2 the penultimate element and so on.
- ///
- /// The key of the list.
- /// The start index of the list to trim to.
- /// The end index of the list to trim to.
- /// The flags to use for this operation.
- ///
+ ///
Task ListTrimAsync(RedisKey key, long start, long stop, CommandFlags flags = CommandFlags.None);
- ///
- /// Extends a lock, if the token value is correct.
- ///
- /// The key of the lock.
- /// The value to set at the key.
- /// The expiration of the lock key.
- /// The flags to use for this operation.
- /// if the lock was successfully extended.
+ ///
Task LockExtendAsync(RedisKey key, RedisValue value, TimeSpan expiry, CommandFlags flags = CommandFlags.None);
- ///
- /// Queries the token held against a lock.
- ///
- /// The key of the lock.
- /// The flags to use for this operation.
- /// The current value of the lock, if any.
+ ///
Task LockQueryAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
- ///
- /// Releases a lock, if the token value is correct.
- ///
- /// The key of the lock.
- /// The value at the key that must match.
- /// The flags to use for this operation.
- /// if the lock was successfully released, otherwise.
+ ///
Task LockReleaseAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None);
- ///
- /// Takes a lock (specifying a token value) if it is not already taken.
- ///
- /// The key of the lock.
- /// The value to set at the key.
- /// The expiration of the lock key.
- /// The flags to use for this operation.
- /// if the lock was successfully taken, otherwise.
+ ///
Task LockTakeAsync(RedisKey key, RedisValue value, TimeSpan expiry, CommandFlags flags = CommandFlags.None);
- ///
- /// Posts a message to the given channel.
- ///
- /// The channel to publish to.
- /// The message to send.
- /// The flags to use for this operation.
- ///
- /// The number of clients that received the message *on the destination server*,
- /// note that this doesn't mean much in a cluster as clients can get the message through other nodes.
- ///
- ///
+ ///
Task PublishAsync(RedisChannel channel, RedisValue message, CommandFlags flags = CommandFlags.None);
- ///
- /// Execute an arbitrary command against the server; this is primarily intended for executing modules,
- /// but may also be used to provide access to new features that lack a direct API.
- ///
- /// The command to run.
- /// The arguments to pass for the command.
- /// A dynamic representation of the command's result.
- /// This API should be considered an advanced feature; inappropriate use can be harmful.
+ ///
Task ExecuteAsync(string command, params object[] args);
- ///
- /// Execute an arbitrary command against the server; this is primarily intended for executing modules,
- /// but may also be used to provide access to new features that lack a direct API.
- ///
- /// The command to run.
- /// The arguments to pass for the command.
- /// The flags to use for this operation.
- /// A dynamic representation of the command's result.
- /// This API should be considered an advanced feature; inappropriate use can be harmful.
+ ///
Task ExecuteAsync(string command, ICollection