### Start a MemoryCache Redis Server Source: https://github.com/stackexchange/stackexchange.redis/blob/main/toys/StackExchange.Redis.Server/readme.md Demonstrates how to instantiate and start a MemoryCacheRedisServer, listening on a specific IP endpoint. Ensure necessary using directives are included. ```csharp using System; using System.Net; using System.Threading.Tasks; using StackExchange.Redis.Server; static class Program { static async Task Main() { using (var server = new MemoryCacheRedisServer(Console.Out)) { server.Listen(new IPEndPoint(IPAddress.Loopback, 6379)); await server.Shutdown; } } } ``` -------------------------------- ### Minimal Server ACL Configuration Example Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/Configuration.md Example of a minimal Redis server Access Control List (ACL) configuration for non-cluster setups. Ensure necessary commands are enabled on the server and also managed via CommandMap if disabled. ```bash -@all +@pubsub +@read +echo +info ``` -------------------------------- ### Install StackExchange.Redis via NuGet Package Manager Console Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/index.md Use this command to install the StackExchange.Redis NuGet package using the Package Manager Console in Visual Studio. ```PowerShell PM> Install-Package StackExchange.Redis ``` -------------------------------- ### HotKeysStartAsync Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Asynchronously starts the hot keys tracking on the Redis server. Use this for non-blocking start operations. ```APIDOC ## HotKeysStartAsync ### Description Asynchronously starts the hot keys tracking on the Redis server. Use this for non-blocking start operations. ### Method POST (conceptual) ### Endpoint Not applicable (SDK method) ### Parameters #### Query Parameters - **metrics** (StackExchange.Redis.HotKeysMetrics) - Optional - Specifies the type of metrics to collect. Defaults to -1 (all metrics). - **count** (long) - Optional - The number of keys to track. Defaults to 0. - **duration** (System.TimeSpan) - Optional - The duration for which to track hot keys. Defaults to 0. - **sampleRatio** (long) - Optional - The ratio for sampling hot keys. Defaults to 1. - **slots** (int[]?) - Optional - An array of slot IDs to track. Defaults to null (all slots). - **flags** (StackExchange.Redis.CommandFlags) - Optional - Specifies command flags to control the execution of the command. ### Response #### Success Response - **Task** - A task that represents the asynchronous operation. ### Response Example (No response body for void operations) ``` -------------------------------- ### Load Test Example Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/RespLogging.md A load test demonstrating setting and retrieving members from a Redis set. This example is used to trigger potential RESP stream issues. ```csharp // connect Console.WriteLine("Connecting..."); var options = ConfigurationOptions.Parse(ConnectionString); await using var muxer = await ConnectionMultiplexer.ConnectAsync(options); var db = muxer.GetDatabase(); // load RedisKey testKey = "marc_abc"; await db.KeyDeleteAsync(testKey); Console.WriteLine("Writing..."); for (int i = 0; i < 100; i++) { // sync every 50 iterations (pipeline the rest) var flags = (i % 50) == 0 ? CommandFlags.None : CommandFlags.FireAndForget; await db.SetAddAsync(testKey, Guid.NewGuid().ToString(), flags); } // fetch Console.WriteLine("Reading..."); int count = 0; for (int i = 0; i < 10; i++) { // this is deliberately not using SCARD // (to put load on the inbound) count += (await db.SetMembersAsync(testKey)).Length; } Console.WriteLine("all done"); ``` -------------------------------- ### Sequential Redis Gets Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/PipelinesMultiplexers.md Demonstrates two sequential StringGet operations without pipelining, illustrating the latency involved. ```csharp string a = db.StringGet("a"); string b = db.StringGet("b"); ``` -------------------------------- ### KeySpace Notification Channels Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/KeyspaceNotifications.md Examples of how to construct KeySpace notification channels for subscribing to key events in specific or all databases. ```csharp RedisChannel.KeySpaceSingleKey("foo", 0) ``` ```csharp RedisChannel.KeySpacePrefix("foo", 0) ``` ```csharp RedisChannel.KeySpacePrefix("foo") ``` ```csharp RedisChannel.KeyEvent(KeyNotificationType.Set, 0) ``` ```csharp RedisChannel.KeyEvent(KeyNotificationType.Set) ``` -------------------------------- ### Version Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the version of the Redis server. This is a property getter. ```APIDOC ## Version ### Description Gets the version of the Redis server. ### Method GET ### Endpoint `/server/version` (assumed endpoint structure) ``` -------------------------------- ### StringGetRangeAsync Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets a sub-string of a string at the specified key, from a start to an end offset. ```APIDOC ## StringGetRangeAsync ### Description Gets a sub-string of a string at the specified key, from a start to an end offset. ### Method `StringGetRangeAsync` ### Parameters - **key** (RedisKey) - The key of the string. - **start** (long) - The starting offset. - **end** (long) - The ending offset. - **flags** (CommandFlags) - Optional flags to control the command execution. ### Returns - **Task** - The sub-string value. ``` -------------------------------- ### Apply Runtime Settings to Configuration Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/Configuration.md Parse a base configuration string, apply runtime-specific settings like ClientName, and then connect. ```csharp string configString = GetRedisConfiguration(); var options = ConfigurationOptions.Parse(configString); options.ClientName = GetAppName(); // only known at runtime options.AllowAdmin = true; conn = ConnectionMultiplexer.Connect(options); ``` -------------------------------- ### Connect to Redis with a Configuration String Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/Configuration.md Establish a connection to a single Redis server on the local machine using a basic host name string. ```csharp var conn = ConnectionMultiplexer.Connect("localhost"); ``` -------------------------------- ### ConnectionMultiplexer.GetServer Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets a server endpoint associated with a given key. This method allows direct interaction with specific Redis servers within a cluster or replication setup. ```APIDOC ## ConnectionMultiplexer.GetServer ### Description Gets a server endpoint associated with a given key. This method allows direct interaction with specific Redis servers within a cluster or replication setup. ### Method ConnectionMultiplexer.GetServer ### Parameters #### Path Parameters - **key** (StackExchange.Redis.RedisKey) - Required - The key to determine the associated server. #### Query Parameters - **asyncState** (object?) - Optional - An object representing the asynchronous state. - **flags** (StackExchange.Redis.CommandFlags) - Optional - Flags to control command execution. ### Response #### Success Response - **StackExchange.Redis.IServer** - An IServer object representing the Redis server. ``` -------------------------------- ### Configuration and Connection Methods Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Details methods for managing default options, parsing configuration strings, and establishing connections to Redis servers. ```APIDOC ## Configuration and Connection Methods ### Description Methods for configuring and connecting to Redis instances using StackExchange.Redis. ### Methods - **DefaultOptionsProvider.AddProvider**: Adds a custom provider for default options. - **DefaultOptionsProvider.ComputerName**: Gets the computer name. - **DefaultOptionsProvider.GetProvider**: Retrieves a default options provider based on endpoints or a single endpoint. - **DefaultOptionsProvider.LibraryVersion**: Gets the library version. - **ConfigurationOptions.Parse**: Parses a configuration string into ConfigurationOptions. - **ConnectionMultiplexer.Connect**: Establishes a connection to Redis using various configuration methods (options object, string, or configure action). - **ConnectionMultiplexer.ConnectAsync**: Asynchronously establishes a connection to Redis using configuration options. ### Parameters - **provider** (DefaultOptionsProvider) - The provider to add. - **endpoints** (EndPointCollection) - A collection of endpoints. - **endpoint** (System.Net.EndPoint) - A single endpoint. - **configuration** (string) - The configuration string. - **ignoreUnknown** (bool) - Whether to ignore unknown configuration parameters. - **configure** (Action) - An action to configure options. - **log** (System.IO.TextWriter) - A writer for logging. ### Return Values - **void**: For AddProvider. - **string**: For ComputerName and LibraryVersion. - **DefaultOptionsProvider**: For GetProvider. - **ConfigurationOptions**: For Parse. - **ConnectionMultiplexer**: For Connect and ConnectAsync. - **Task**: For ConnectAsync. ``` -------------------------------- ### HotKeysStart Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Starts the hot keys tracking on the Redis server with specified parameters. Allows configuration of metrics, count, duration, sample ratio, and slots. ```APIDOC ## HotKeysStart ### Description Starts the hot keys tracking on the Redis server with specified parameters. Allows configuration of metrics, count, duration, sample ratio, and slots. ### Method POST (conceptual) ### Endpoint Not applicable (SDK method) ### Parameters #### Query Parameters - **metrics** (StackExchange.Redis.HotKeysMetrics) - Optional - Specifies the type of metrics to collect. Defaults to -1 (all metrics). - **count** (long) - Optional - The number of keys to track. Defaults to 0. - **duration** (System.TimeSpan) - Optional - The duration for which to track hot keys. Defaults to 0. - **sampleRatio** (long) - Optional - The ratio for sampling hot keys. Defaults to 1. - **slots** (int[]?) - Optional - An array of slot IDs to track. Defaults to null (all slots). - **flags** (StackExchange.Redis.CommandFlags) - Optional - Specifies command flags to control the execution of the command. ### Response #### Success Response (200) - void - Indicates the operation was successful. ### Response Example (No response body for void operations) ``` -------------------------------- ### Set Client Certificate from PEM Files Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/Authentication.md Configure client certificate authentication using separate public and private key files in PEM format. Requires paths to the .crt and .key files. ```csharp options.SetUserPemCertificate( userCertificatePath: userCrtPath, userKeyPath: userKeyPath ); ``` -------------------------------- ### Connect with Multiple Hosts and Options Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/Configuration.md Connect to multiple Redis servers and set configuration options like 'allowAdmin' using a comma-delimited string. ```csharp var conn = ConnectionMultiplexer.Connect("redis0:6380,redis1:6380,allowAdmin=true"); ``` -------------------------------- ### Get Redis Array Metadata Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/Arrays.md Retrieves metadata for a Redis array, such as count, length, and next insert index, using `ArrayInfoAsync`. The `full` parameter can be used to get more detailed information. ```csharp ArrayInfo info = await db.ArrayInfoAsync(key); ArrayInfo fullInfo = await db.ArrayInfoAsync(key, full: true); Console.WriteLine($"Count: {info.Count}"); Console.WriteLine($"Length: {info.Length}"); Console.WriteLine($"Next insert index: {info.NextInsertIndex}"); ``` -------------------------------- ### Setting Up Keyspace Isolation with a Prefix Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/KeyspaceNotifications.md Demonstrates how to apply a key prefix to a Redis database instance for a multi-tenant scenario. This prefix is used when setting keys. ```csharp // multi-tenant scenario using keyspace isolation byte[] keyPrefix = Encoding.UTF8.GetBytes("client1234:"); var db = conn.GetDatabase().WithKeyPrefix(keyPrefix); // we will later commit order data for example: await db.StringSetAsync("order/123", "ISBN 9789123684434"); ``` -------------------------------- ### ArrayLength Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the length of an array. ```APIDOC ## ArrayLength ### Description Gets the length of an array. ### Method Not applicable (SDK method) ### Endpoint Not applicable (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **RedisArrayIndex**: The length of the array. #### Response Example None ``` -------------------------------- ### HotKeysAsync Methods Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/HotKeys.md Demonstrates the usage of HotKeysStartAsync, HotKeysGetAsync, and HotKeysResetAsync methods for server-side profiling. ```APIDOC ## HotKeysAsync Methods ### Description These methods allow for server-side profiling of CPU and network usage by key using the `HOTKEYS` command, available in Redis 8.6 and later. ### Methods - `HotKeysStartAsync(duration, optional_parameters)`: Starts the CPU and network profiling session. A duration is recommended to ensure the profiler stops. Optional parameters allow specifying metrics, sample ratio, and key slots. - `HotKeysGetAsync()`: Fetches the results of the active profiling session. This does not stop the capture and can be called multiple times. - `HotKeysResetAsync()`: Discards the active capture data on the server. ### Usage Example ```csharp // Get the server instance. IConnectionMultiplexer muxer = ... // connect to Redis 8.6 or later var server = muxer.GetServer(endpoint); // or muxer.GetServer(key) // Start the capture; you can specify a duration, or manually use the HotKeysStop[Async] method; specifying // a duration is recommended, so that the profiler will not be left running in the case of failure. // Optional parameters allow you to specify the metrics to capture, the sample ratio, and the key slots to include; // by default, all metrics are captured, every command is sampled, and all key slots are included. await server.HotKeysStartAsync(duration: TimeSpan.FromSeconds(30)); // Now either do some work ourselves, or await for some other activity to happen: await Task.Delay(TimeSpan.FromSeconds(35)); // whatever happens: happens // Fetch the results; note that this does not stop the capture, and you can fetch the results multiple times // either while it is running, or after it has completed - but only a single capture can be active at a time. var result = await server.HotKeysGetAsync(); // ...investigate the results... // Optional: discard the active capture data at the server, if any. await server.HotKeysResetAsync(); ``` ### HotKeysResult Properties The `HotKeysResult` class contains the following properties: - `Metrics`: The metrics captured during this profiling session. - `TrackingActive`: Indicates whether the capture currently active. - `SampleRatio`: Profiling frequency; effectively: measure every Nth command. (also: `IsSampled`) - `SelectedSlots`: The key slots active for this profiling session. - `CollectionStartTime`: The start time of the capture. - `CollectionDuration`: The duration of the capture. - `AllCommandsAllSlotsTime`: The total CPU time measured for all commands in all slots, without any sampling or filtering applied. - `AllCommandsAllSlotsNetworkBytes`: The total network usage measured for all commands in all slots, without any sampling or filtering applied. When slot filtering is used, the following properties are also available: - `AllCommandsSelectedSlotsTime`: The total CPU time measured for all commands in the selected slots. - `AllCommandsSelectedSlotsNetworkBytes`: The total network usage measured for all commands in the selected slots. When slot filtering *and* sampling is used, the following properties are also available: - `SampledCommandsSelectedSlotsTime`: The total CPU time measured for the sampled commands in the selected slots. - `SampledCommandsSelectedSlotsNetworkBytes`: The total network usage measured for the sampled commands in the selected slots. If CPU metrics were captured, the following properties are also available: - `TotalCpuTimeUser`: The total user CPU time measured in the profiling session. - `TotalCpuTimeSystem`: The total system CPU time measured in the profiling session. - `TotalCpuTime`: The total CPU time measured in the profiling session. - `CpuByKey`: Hot keys, as measured by CPU activity; for each: - `Key`: The key observed. - `Duration`: The time taken. If network metrics were captured, the following properties are also available: - `TotalNetworkBytes`: The total network data measured in the profiling session. - `NetworkBytesByKey`: Hot keys, as measured by network activity; for each: - `Key`: The key observed. - `Bytes`: The network activity, in bytes. ### Notes - To use slot-based filtering, you must be connected to a Redis Cluster instance. - The `IConnectionMultiplexer.HashSlot(RedisKey)` method can be used to determine the slot for a given key. - The key can also be used in place of an endpoint when using `GetServer(...)` to get the `IServer` instance for a given key. ``` -------------------------------- ### KeyNotification.Kind Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the type of key notification. ```APIDOC ## KeyNotification.Kind ### Description This property returns a `KeyNotificationKind` enum value, indicating the specific type of key notification received (e.g., KeyEvent, KeySpace, SubKeyEvent, SubKeySpace). ### Property Type `StackExchange.Redis.KeyNotificationKind` ``` -------------------------------- ### ISubscriber.SubscribedEndpoint Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the endpoint of the subscribed channel. ```APIDOC ## ISubscriber.SubscribedEndpoint ### Description Gets the endpoint of the subscribed channel. ### Method GET (conceptual) ### Endpoint N/A (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **channel** (RedisChannel) - Required - The channel to get the endpoint for. ### Request Example ```csharp EndPoint endpoint = subscriber.SubscribedEndpoint(channel); ``` ### Response #### Success Response - **endpoint** (EndPoint?) - The endpoint of the subscribed channel, or null if not subscribed. #### Response Example ```json "127.0.0.1:6379" ``` ``` -------------------------------- ### ConfigurationOptions Methods Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Methods for configuring connection options. ```APIDOC ## ConfigurationOptions Methods ### Description Methods for configuring connection options. ### Properties - **Protocol** (StackExchange.Redis.RedisProtocol) - Gets or sets the Redis protocol. ### Methods - **SetUserPfxCertificate(string! userCertificatePath, string? password = null)** - Sets the user's PFX certificate for authentication. ``` -------------------------------- ### StreamLengthAsync Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the number of entries in a stream. ```APIDOC ## StreamLengthAsync ### Description Retrieves the total number of entries in a specified Redis stream. ### Method `StreamLengthAsync(RedisKey key, CommandFlags flags = CommandFlags.None)` ### Parameters #### Path Parameters - **key** (RedisKey) - Required - The key of the stream. - **flags** (CommandFlags) - Optional - Flags that specify how the operation is performed. ### Response #### Success Response (200) - **Task** - The number of entries in the stream. ``` -------------------------------- ### SetLengthAsync Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the number of members in a Set. ```APIDOC ## SetLengthAsync ### Description Gets the number of members in a Set. ### Method `SetLengthAsync` ### Parameters - **key** (RedisKey) - The key of the Set. - **flags** (CommandFlags) - Optional flags to control command execution. ### Returns A Task that represents the asynchronous operation. The value of the TResult parameter contains the number of members in the Set. ``` -------------------------------- ### KeyRefCount Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the reference count of a key. ```APIDOC ## KeyRefCount ### Description Gets the reference count of a key. This is a Redis internal metric. ### Method `KeyRefCount` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **key** (StackExchange.Redis.RedisKey) - The key to get the reference count for. * **flags** (StackExchange.Redis.CommandFlags) - Optional command flags. ### Response #### Success Response - **long?**: The reference count, or null if the key does not exist. ``` -------------------------------- ### MakePrimaryAsync Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Asynchronously configures the current server to become a primary (master). ```APIDOC ## MakePrimaryAsync ### Description Asynchronously configures the current server to become a primary (master). ### Method POST (conceptual) ### Endpoint /server/{server_id}/makePrimary/async ### Parameters #### Request Body - **options** (ReplicationChangeOptions) - Required - Options for the replication change. - **log** (TextWriter) - Optional - A writer for logging output. ### Response #### Success Response (200) - **Task** - A task representing the asynchronous operation. ``` -------------------------------- ### Subscribing to All Tenants' Keyspace Notifications Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/KeyspaceNotifications.md Demonstrates subscribing to keyspace notifications for all tenants using a wildcard pattern. This approach requires manual parsing of the client from the full key. ```csharp var channel = RedisChannel.KeySpacePattern("client*:order/*", db.Database); ``` -------------------------------- ### KeyIdleTime Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the idle time of a key. ```APIDOC ## KeyIdleTime ### Description Gets the idle time of a key, which is the time elapsed since the last access. ### Method `KeyIdleTime` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **key** (StackExchange.Redis.RedisKey) - The key to get the idle time for. * **flags** (StackExchange.Redis.CommandFlags) - Optional command flags. ### Response #### Success Response - **System.TimeSpan?**: The idle time as a `TimeSpan`, or null if the key does not exist. ``` -------------------------------- ### KeyExpireTime Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the expiration time of a key. ```APIDOC ## KeyExpireTime ### Description Gets the expiration time of a key as a `DateTime` object. ### Method `KeyExpireTime` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **key** (StackExchange.Redis.RedisKey) - The key to get the expiration time for. * **flags** (StackExchange.Redis.CommandFlags) - Optional command flags. ### Response #### Success Response - **System.DateTime?**: The expiration time, or null if the key does not expire or does not exist. ``` -------------------------------- ### ArrayCountAsync Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Asynchronously gets the count of elements in an array. ```APIDOC ## ArrayCountAsync ### Description Asynchronously gets the count of elements in an array. ### Method Not applicable (SDK method) ### Endpoint Not applicable (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **Task**: A task that represents the asynchronous operation, returning the count of elements. #### Response Example None ``` -------------------------------- ### ConfigurationOptions Methods Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt This section details the methods available on the ConfigurationOptions class for initializing and configuring Redis connections. ```APIDOC ## ConfigurationOptions Methods ### Description Provides methods for initializing and configuring Redis connection options. ### Methods - **ConfigurationOptions()** - Initializes a new instance of the ConfigurationOptions class. - **SetDefaultPorts()** - Sets the default ports for the configuration. - **ToString(bool includePassword)** - Returns a string representation of the configuration options, optionally including the password. - **TrustIssuer(string issuerCertificatePath)** - Trusts the issuer certificate from the specified path. - **TrustIssuer(System.Security.Cryptography.X509Certificates.X509Certificate2! issuer)** - Trusts the specified issuer certificate. ``` -------------------------------- ### ArrayNext Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the next available index in an array. ```APIDOC ## ArrayNext ### Description Gets the next available index in an array. ### Method Not applicable (SDK method) ### Endpoint Not applicable (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **RedisArrayIndex?**: The next available index, or null if no more indices are available. #### Response Example None ``` -------------------------------- ### Connect to Redis with ConfigurationOptions Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/Configuration.md Connect to Redis using a ConfigurationOptions object. This is useful when you need to apply specific settings at runtime. ```csharp var conn = ConnectionMultiplexer.Connect(configuration); ``` -------------------------------- ### Set Client Certificate from PFX File Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/Authentication.md Configure client certificate authentication using a single PFX file containing the public and private key pair. An optional password can be provided. ```csharp options.SetUserPfxCertificate( userCertificatePath: userCrtPath, password: filePassword // optional ); ``` -------------------------------- ### VectorSetLength Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the number of elements in a vector set. ```APIDOC ## VectorSetLength ### Description Returns the number of elements (vectors) currently stored in the specified vector set. ### Method `IDatabase.VectorSetLength` ### Parameters - **key** (RedisKey) - The key identifying the vector set. - **flags** (CommandFlags) - Optional flags to control the command's behavior. Defaults to `CommandFlags.None`. ### Response #### Success Response - **long** - The number of elements in the vector set. ``` -------------------------------- ### Subscribe to KeySpace Notifications (Queue-based) Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/KeyspaceNotifications.md This example demonstrates the queue-based approach for subscribing to keyspace notifications. It uses an async foreach loop to process messages from a queue. ```csharp var queue = await sub.SubscribeAsync(channel); _ = Task.Run(async () => { await foreach (var msg in queue) { if (msg.TryParseKeyNotification(out var notification)) { Console.WriteLine($"Key: {notification.GetKey()}"); Console.WriteLine($"Type: {notification.Type}"); Console.WriteLine($"Database: {notification.Database}"); } } }); ``` -------------------------------- ### IServer.SentinelMasters Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets details for all masters known to Sentinel. ```APIDOC ## IServer.SentinelMasters ### Description Retrieves detailed information about all master nodes known to the Sentinel. ### Method GET ### Endpoint Not applicable (SDK method) ### Parameters #### Query Parameters - **flags** (StackExchange.Redis.CommandFlags) - Optional - Flags to control command execution. ### Response #### Success Response (200) - **MastersInfo** (System.Collections.Generic.KeyValuePair[][]) - A 2D array of key-value pairs containing master details. ``` -------------------------------- ### IServer.RoleAsync Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Asynchronously gets the role of the Redis server. ```APIDOC ## IServer.RoleAsync ### Description Asynchronously retrieves the current role of the Redis server. ### Method GET ### Endpoint Not applicable (SDK method) ### Parameters #### Query Parameters - **flags** (StackExchange.Redis.CommandFlags) - Optional - Flags to control command execution. ### Response #### Success Response - **Role** (StackExchange.Redis.Role) - The role of the server. ``` -------------------------------- ### Manual Configuration with Endpoints and CommandMap Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/Configuration.md Use ConfigurationOptions to manually set endpoints, exclude specific commands, configure keep-alive, set the default server version, and specify a password. This is useful when server commands for automatic configuration are disabled. ```csharp ConfigurationOptions config = new ConfigurationOptions { EndPoints = { { "redis0", 6379 }, { "redis1", 6380 } }, CommandMap = CommandMap.Create(new HashSet { "INFO", "CONFIG", "CLUSTER", "PING", "ECHO", "CLIENT" }, available: false), KeepAlive = 180, DefaultVersion = new Version(2, 8, 8), Password = "changeme" }; ``` ```config redis0:6379,redis1:6380,keepAlive=180,version=2.8.8,$CLIENT=,$CLUSTER=,$CONFIG=,$ECHO=,$INFO=,$PING= ``` -------------------------------- ### Connect to Redis Instance Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/Basics.md Establish a connection to a Redis instance on the local machine. This ConnectionMultiplexer object should be stored and reused throughout your application. ```csharp using StackExchange.Redis; ... ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost"); // ^^^ store and re-use this!!! ``` -------------------------------- ### Features Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the Redis features supported by the server. ```APIDOC ## Features ### Description Gets the Redis features supported by the server. ### Method `get` (property accessor) ### Returns `StackExchange.Redis.RedisFeatures` ``` -------------------------------- ### EndPoint Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the network endpoint of the Redis server. ```APIDOC ## EndPoint ### Description Gets the network endpoint of the Redis server. ### Method `get` (property accessor) ### Returns `System.Net.EndPoint` ``` -------------------------------- ### Handling KeySpace Notifications with Database Information Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/KeyspaceNotifications.md Demonstrates how to subscribe to KeySpace notifications without specifying a database and then parse the received channel to extract key and database information. ```csharp var channel = RedisChannel.KeySpacePrefix("foo"); sub.SubscribeAsync(channel, (recvChannel, recvValue) => { if (KeyNotification.TryParse(recvChannel, recvValue, out var notification)) { var key = notification.GetKey(); var db = notification.Database; // ... } } ``` -------------------------------- ### StringGetAsync Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the value of a string at the specified key. ```APIDOC ## StringGetAsync (Single Key) ### Description Gets the value of a string at the specified key. ### Method `StringGetAsync` ### Parameters - **key** (RedisKey) - The key of the string. - **flags** (CommandFlags) - Optional flags to control the command execution. ### Returns - **Task** - The value of the string. ``` ```APIDOC ## StringGetAsync (Multiple Keys) ### Description Gets the values of multiple strings at the specified keys. ### Method `StringGetAsync` ### Parameters - **keys** (RedisKey[]) - An array of keys for the strings. - **flags** (CommandFlags) - Optional flags to control the command execution. ### Returns - **Task** - An array of values corresponding to the keys. ``` -------------------------------- ### KeyFrequency Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the access frequency counter of a key. ```APIDOC ## KeyFrequency ### Description Gets the access frequency counter of a key. This is a Redis internal metric. ### Method `KeyFrequency` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **key** (StackExchange.Redis.RedisKey) - The key to get the frequency for. * **flags** (StackExchange.Redis.CommandFlags) - Optional command flags. ### Response #### Success Response - **long?**: The access frequency counter, or null if the key does not exist. ``` -------------------------------- ### Connect to Multiple Redis Servers Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/Basics.md Connect to a Redis setup with multiple servers, such as a primary/replica configuration. The library automatically identifies the primary server. ```csharp ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("server1:6379,server2:6379"); ``` -------------------------------- ### Subscribe to KeySpace Notifications (Callback-based) Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/KeyspaceNotifications.md This example demonstrates the callback-based approach for subscribing to keyspace notifications. A provided callback function is executed for each received message. ```csharp sub.Subscribe(channel, (recvChannel, recvValue) => { if (KeyNotification.TryParse(recvChannel, recvValue, out var notification)) { Console.WriteLine($"Key: {notification.GetKey()}"); Console.WriteLine($"Type: {notification.Type}"); Console.WriteLine($"Database: {notification.Database}"); Console.WriteLine($"Kind: {notification.Kind}"); // For sub-key notifications (Redis 8.8+), you can access sub-keys in a uniform way, // regardless of the notification type if (notification.HasSubKey) { // Get the first sub-key Console.WriteLine($"First SubKey: {notification.GetSubKeys().First()}"); // Or iterate all sub-keys (for notifications with multiple fields) foreach (var subKey in notification.GetSubKeys()) { Console.WriteLine($"SubKey: {subKey}"); } } } }); ``` -------------------------------- ### StackExchange.Redis.RedisValue.StartsWith Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Checks if a RedisValue starts with a specified byte sequence. ```APIDOC ## Method for StackExchange.Redis.RedisValue.StartsWith ### Description This method checks if the current `RedisValue` begins with a specified sequence of bytes. ### Method #### StartsWith(System.ReadOnlySpan value) - **Description**: Determines whether the `RedisValue` begins with the specified byte sequence. - **Parameters**: - `value` (System.ReadOnlySpan) - The byte sequence to compare against the beginning of the `RedisValue`. - **Returns**: `bool` - `true` if the `RedisValue` starts with the specified sequence; otherwise, `false`. ``` -------------------------------- ### KeyMigrateAsync Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Migrates a key from the current server to a specified server and database. Supports options for handling existing keys and timeouts. ```APIDOC ## KeyMigrateAsync ### Description Migrates a key from the current server to a specified server and database. Supports options for handling existing keys and timeouts. ### Method `KeyMigrateAsync` ### Parameters #### Path Parameters - **key** (StackExchange.Redis.RedisKey) - Required - The key to migrate. - **toServer** (System.Net.EndPoint) - Required - The endpoint of the destination server. - **toDatabase** (int) - Optional - The target database ID (default is 0). - **timeoutMilliseconds** (int) - Optional - The timeout for the migration in milliseconds (default is 0, meaning no timeout). - **migrateOptions** (StackExchange.Redis.MigrateOptions) - Optional - Options for the migration process (default is None). - **flags** (StackExchange.Redis.CommandFlags) - Optional - Flags to control command execution. ### Response #### Success Response - **System.Threading.Tasks.Task** - Indicates the completion of the migration operation. ``` -------------------------------- ### Batch Vector Inserts using Pipelining Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/VectorSets.md For bulk inserts, use pipelining with db.CreateBatch() to improve performance. Execute the batch and await all tasks. ```csharp var batch = db.CreateBatch(); var tasks = new List>(); foreach (var (member, vector) in vectorData) { var request = VectorSetAddRequest.Member(member, vector.AsMemory()); tasks.Add(batch.VectorSetAddAsync(key, request)); } batch.Execute(); await Task.WhenAll(tasks); ``` -------------------------------- ### TimeAsync Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the current server time. This is an asynchronous operation. ```APIDOC ## TimeAsync ### Description Gets the current server time. This is an asynchronous operation. ### Method GET (assumed, as it's a read operation) ### Endpoint `/server/timeAsync` (assumed endpoint structure) ### Parameters #### Query Parameters - **flags** (StackExchange.Redis.CommandFlags) - Optional - Flags to control command behavior. ``` -------------------------------- ### Example RESP Stream Output Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/RespLogging.md Illustrates typical output from RESP streams, showing client commands and server responses, including successful acknowledgments and error messages. ```txt $6 CLIENT $7 SETNAME ... +OK +OK +OK ... ``` ```txt > CLUSTER NODES < -ERR This instance has cluster support disabled > GET __Booksleeve_TieBreak < (null) > ECHO ... < -Invalid bulk string terminator ``` -------------------------------- ### Time Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the current server time. This is a synchronous operation. ```APIDOC ## Time ### Description Gets the current server time. This is a synchronous operation. ### Method GET (assumed, as it's a read operation) ### Endpoint `/server/time` (assumed endpoint structure) ### Parameters #### Query Parameters - **flags** (StackExchange.Redis.CommandFlags) - Optional - Flags to control command behavior. ``` -------------------------------- ### SubscriptionPatternCountAsync Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the number of pattern-subscribed clients. This is an asynchronous operation. ```APIDOC ## SubscriptionPatternCountAsync ### Description Gets the number of pattern-subscribed clients. This is an asynchronous operation. ### Method GET (assumed, as it's a read operation) ### Endpoint `/server/subscriptionPatternCountAsync` (assumed endpoint structure) ### Parameters #### Query Parameters - **flags** (StackExchange.Redis.CommandFlags) - Optional - Flags to control command behavior. ``` -------------------------------- ### Prepare and Evaluate Lua Script Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/Scripting.md Use LuaScript.Prepare to create a script object that automatically handles variable rewriting and parameter passing. Evaluate directly with a database connection. ```csharp const string Script = "redis.call('set', @key, @value)"; using (ConnectionMultiplexer conn = /* init code */) { var db = conn.GetDatabase(0); var prepared = LuaScript.Prepare(Script); db.ScriptEvaluate(prepared, new { key = (RedisKey)"mykey", value = 123 }); } ``` -------------------------------- ### RedisKey Methods and Constructor Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Details the methods and constructor for RedisKey, representing a Redis key. ```APIDOC ## StackExchange.Redis.RedisKey ### Description Represents a key in Redis, providing methods for manipulation and comparison. ### Methods - **Append(RedisKey suffix)**: Appends a suffix to the current key. - **Equals(RedisKey other)**: Compares the current key with another RedisKey for equality. - **Prepend(RedisKey prefix)**: Prepends a prefix to the current key. ### Constructor - **RedisKey()**: Initializes an empty RedisKey. - **RedisKey(string? key)**: Initializes a RedisKey with the specified string value. ``` -------------------------------- ### SubscriptionPatternCount Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the number of pattern-subscribed clients. This is a synchronous operation. ```APIDOC ## SubscriptionPatternCount ### Description Gets the number of pattern-subscribed clients. This is a synchronous operation. ### Method GET (assumed, as it's a read operation) ### Endpoint `/server/subscriptionPatternCount` (assumed endpoint structure) ### Parameters #### Query Parameters - **flags** (StackExchange.Redis.CommandFlags) - Optional - Flags to control command behavior. ``` -------------------------------- ### Build and Run Tests on Windows Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/Testing.md Execute the build script on Windows to run tests. The `-BuildNumber local` argument is used for local builds. ```cmd .\build.cmd -BuildNumber local ``` -------------------------------- ### ServerType Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the type of the Redis server. This is a property getter. ```APIDOC ## ServerType ### Description Gets the type of the Redis server. ### Method GET ### Endpoint `/server/type` (assumed endpoint structure) ``` -------------------------------- ### IServer.SentinelMastersAsync Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Asynchronously gets details for all masters known to Sentinel. ```APIDOC ## IServer.SentinelMastersAsync ### Description Asynchronously retrieves detailed information about all master nodes known to the Sentinel. ### Method GET ### Endpoint Not applicable (SDK method) ### Parameters #### Query Parameters - **flags** (StackExchange.Redis.CommandFlags) - Optional - Flags to control command execution. ### Response #### Success Response (200) - **MastersInfo** (System.Collections.Generic.KeyValuePair[][]) - A 2D array of key-value pairs containing master details. ``` -------------------------------- ### Evaluate Lua Script with Keys and Arguments Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/KeysValues.md Example of executing a Lua script using `ScriptEvaluate`. It shows how to pass separate arrays for keys and arguments, which correspond to `KEYS` and `ARGV` within the script. ```csharp var result = db.ScriptEvaluate(TransferScript, new RedisKey[] { from, to }, new RedisValue[] { quantity }); ``` -------------------------------- ### DatabaseCount Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the number of databases available on the Redis server. ```APIDOC ## DatabaseCount ### Description Gets the number of databases available on the Redis server. ### Method `get` (property accessor) ### Returns `int` ``` -------------------------------- ### StormLogThreshold Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets or sets the threshold for the storm log, in milliseconds. ```APIDOC ## StormLogThreshold ### Description Gets or sets the threshold for the storm log, in milliseconds. ### Method `StormLogThreshold.get` `StormLogThreshold.set` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response - **int**: The storm log threshold in milliseconds. ### Response Example None ``` -------------------------------- ### Create RedisChannel for KeySpace Prefix Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/KeyspaceNotifications.md This snippet shows how to create a RedisChannel to subscribe to all keys with a specific prefix in a given database. It supports Redis Cluster. ```csharp // this will subscribe to __keyspace@0__:user:*, including supporting Redis Cluster var channel = RedisChannel.KeySpacePrefix(prefix: "user:"u8, database: 0); ``` -------------------------------- ### ArrayGetRangeAsync Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Retrieves a range of elements from an array between a start and end index. ```APIDOC ## ArrayGetRangeAsync ### Description Retrieves a contiguous range of elements from an array. ### Method `ArrayGetRangeAsync` ### Parameters - **key** (RedisKey) - The key of the array. - **start** (RedisArrayIndex) - The starting index of the range. - **end** (RedisArrayIndex) - The ending index of the range. - **flags** (CommandFlags) - Optional command flags. ### Returns - **Task** - A task that represents the asynchronous operation, returning an array of RedisValues within the specified range. ``` -------------------------------- ### MakeMaster Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Configures the current server to become a master, potentially demoting existing masters. ```APIDOC ## MakeMaster ### Description Configures the current server to become a master, potentially demoting existing masters. ### Method POST (conceptual) ### Endpoint /server/{server_id}/makeMaster ### Parameters #### Request Body - **options** (ReplicationChangeOptions) - Required - Options for the replication change. - **log** (TextWriter) - Optional - A writer for logging output. ### Response #### Success Response (200) - **void** - Operation completed successfully. ``` -------------------------------- ### Matching Isolated Literals Using Generated Helpers Source: https://github.com/stackexchange/stackexchange.redis/blob/main/eng/StackExchange.Redis.Build/AsciiHash.md Demonstrates how to use the generated helper methods for matching tokens. It's recommended to switch on the `Length` first for potential compiler optimizations, followed by a hash and sequence equality check. ```csharp var key = ... var hash = key.HashCS(); switch (key.Length) { case bin.Length when bin.Is(key, hash): // handle bin break; case f32.Length when f32.Is(key, hash): // handle f32 break; } ``` -------------------------------- ### Configuration.AzureManagedRedisOptionsProvider.ConfigurationChannel Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the configuration channel name for Azure Managed Redis. ```APIDOC ## Configuration.AzureManagedRedisOptionsProvider.ConfigurationChannel ### Description This property retrieves the name of the channel used for configuration updates or management in an Azure Managed Redis instance. It is part of the options provider for Azure-specific Redis configurations. ### Property Type `string` ``` -------------------------------- ### SubscriptionSubscriberCountAsync Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the number of subscribers to a specific channel. This is an asynchronous operation. ```APIDOC ## SubscriptionSubscriberCountAsync ### Description Gets the number of subscribers to a specific channel. This is an asynchronous operation. ### Method GET (assumed, as it's a read operation) ### Endpoint `/server/subscriptionSubscriberCountAsync` (assumed endpoint structure) ### Parameters #### Query Parameters - **channel** (StackExchange.Redis.RedisChannel) - Required - The channel to check. - **flags** (StackExchange.Redis.CommandFlags) - Optional - Flags to control command behavior. ``` -------------------------------- ### Start, Capture, and Retrieve Hot Keys Profiling Data Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/HotKeys.md Use `HotKeysStartAsync` to begin profiling, specify a duration for automatic stopping, and then `HotKeysGetAsync` to fetch the results. The capture can be reset with `HotKeysResetAsync`. Ensure you are connected to Redis 8.6 or later. ```csharp // Get the server instance. IConnectionMultiplexer muxer = ... // connect to Redis 8.6 or later var server = muxer.GetServer(endpoint); // or muxer.GetServer(key) // Start the capture; you can specify a duration, or manually use the HotKeysStop[Async] method; specifying // a duration is recommended, so that the profiler will not be left running in the case of failure. // Optional parameters allow you to specify the metrics to capture, the sample ratio, and the key slots to include; // by default, all metrics are captured, every command is sampled, and all key slots are included. await server.HotKeysStartAsync(duration: TimeSpan.FromSeconds(30)); // Now either do some work ourselves, or await for some other activity to happen: await Task.Delay(TimeSpan.FromSeconds(35)); // whatever happens: happens // Fetch the results; note that this does not stop the capture, and you can fetch the results multiple times // either while it is running, or after it has completed - but only a single capture can be active at a time. var result = await server.HotKeysGetAsync(); // ...investigate the results... // Optional: discard the active capture data at the server, if any. await server.HotKeysResetAsync(); ``` -------------------------------- ### ArrayInfo Constructor and Methods Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Details the constructor and methods for ArrayInfo, including dictionary conversion and indexed access. ```APIDOC ## ArrayInfo Constructor and Methods ### Description This section covers the constructor for `ArrayInfo` which takes a span of key-value pairs, a method to convert it to a dictionary, and property access for retrieving values by key. ### Constructor - `ArrayInfo(scoped System.ReadOnlySpan> values)`: Initializes a new instance of `ArrayInfo` with the provided key-value pairs. ### Methods - `ToDictionary()`: Converts the `ArrayInfo` to a `Dictionary`. ### Properties - `this[string! key].get`: Retrieves the `RedisValue` associated with the specified key. ``` -------------------------------- ### SubscriptionSubscriberCount Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets the number of subscribers to a specific channel. This is a synchronous operation. ```APIDOC ## SubscriptionSubscriberCount ### Description Gets the number of subscribers to a specific channel. This is a synchronous operation. ### Method GET (assumed, as it's a read operation) ### Endpoint `/server/subscriptionSubscriberCount` (assumed endpoint structure) ### Parameters #### Query Parameters - **channel** (StackExchange.Redis.RedisChannel) - Required - The channel to check. - **flags** (StackExchange.Redis.CommandFlags) - Optional - Flags to control command behavior. ``` -------------------------------- ### Enable Keyspace Notifications (Basic) Source: https://github.com/stackexchange/stackexchange.redis/blob/main/docs/KeyspaceNotifications.md Configure your Redis server to enable basic keyspace and keyevent notifications. This is a prerequisite for using StackExchange.Redis for event monitoring. ```conf notify-keyspace-events AKE ``` -------------------------------- ### IServer.SentinelReplicas Source: https://github.com/stackexchange/stackexchange.redis/blob/main/src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt Gets replica details for a given Sentinel service name. ```APIDOC ## IServer.SentinelReplicas ### Description Retrieves detailed information about the replica nodes for a specified Sentinel-managed service. ### Method GET ### Endpoint Not applicable (SDK method) ### Parameters #### Query Parameters - **serviceName** (string) - Required - The name of the Redis service. - **flags** (StackExchange.Redis.CommandFlags) - Optional - Flags to control command execution. ### Response #### Success Response (200) - **ReplicasInfo** (System.Collections.Generic.KeyValuePair[][]) - A 2D array of key-value pairs containing replica details. ```