Open sandboxFocus

Class RedisCachingBackendConfiguration

Configuration for RedisCachingBackend.

Inheritance
RedisCachingBackendConfiguration
Namespace: Metalama.Patterns.Caching.Backends.Redis
Assembly: Metalama.Patterns.Caching.Backends.Redis.dll
Syntax
public record RedisCachingBackendConfiguration : CachingBackendConfiguration, IEquatable<CachingBackendConfiguration>, IEquatable<RedisCachingBackendConfiguration>
Remarks

By default, the StackExchange.Redis.IConnectionMultiplexer is retrieved from the IServiceProvider. To define another way to get the StackExchange.Redis.IConnectionMultiplexer, set the Connection or NewConnectionOptions properties.

Constructors

Name Description
RedisCachingBackendConfiguration()

Initializes a new instance of the RedisCachingBackendConfiguration class.

RedisCachingBackendConfiguration(RedisCachingBackendConfiguration)
RedisCachingBackendConfiguration(ConfigurationOptions, string?)

Initializes a new instance of the RedisCachingBackendConfiguration class that creates a new StackExchange.Redis.IConnectionMultiplexer.

RedisCachingBackendConfiguration(IConnectionMultiplexer, ConfigurationOptions?, string?)

Initializes a new instance of the RedisCachingBackendConfiguration class that with a given StackExchange.Redis.IConnectionMultiplexer.

Properties

Name Description
Connection

Gets or sets the StackExchange.Redis.IConnectionMultiplexer that will be used by the Redis CachingBackend.

ConnectionTimeout

Gets the time that the Redis backend will wait for a Redis connection. (When you create a new Redis backend, if it doesn't connect to a Redis server in this timeout, a TimeoutException is thrown.)

CreateSerializer

Gets or sets a function that creates the serializer used to serialize objects into byte arrays (and conversely). The default value is null, which means that JsonCachingSerializer will be used.

Database

Gets or sets the index of the database to use. The default value is -1 (automatic selection).

DefaultExpiration

Gets or sets the default expiration time of cached items. All items that don't have an explicit expiration time are automatically expired according to the value of this property, unless they have the NotRemovable priority. The default value is 1 day.

EqualityContract
KeyPrefix

Gets or sets the prefix for the key of all Redis items created by the RedisCachingBackend. The default value is cache.

LogRedisConnection

Gets or sets a value indicating whether the logs of the StackExchange.Redis.ConnectionMultiplexer should be captured and redirected. The default value is false.

NewConnectionOptions

Gets or sets the StackExchange.Redis.ConfigurationOptions that will be used to create a new StackExchange.Redis.ConnectionMultiplexer for use by the new Redis CachingBackend.

OwnsConnection

Gets or sets a value indicating whether determines whether the RedisCachingBackend should dispose the Redis connection when the RedisCachingBackend itself is disposed. The default value is false.

ReadCommandFlags

Gets or sets the Redis StackExchange.Redis.CommandFlags for read-only operations. The default value is StackExchange.Redis.CommandFlags.PreferReplica.

RunGarbageCollector

Gets or sets a value indicating whether the dependency garbage collector process should run while the caching back-end instance is alive. This property only makes sense when SupportsDependencies is set to true. The value of RunGarbageCollector is false by default. It is necessary to have at least one instance of the garbage collector active at any time. It is allowed but useless to have several concurrent instances of the garbage collector, but having a large number of them can hurt performance of the Redis server. The recommended approach to run the garbage collector is to deploy a separate application that only hosts this service. See CreateRedisCacheDependencyGarbageCollector(RedisCachingBackendConfiguration, IServiceProvider?) for details.

SupportsDependencies

Gets or sets a value indicating whether the RedisCachingBackend should support dependencies. When this property is used, the DependenciesRedisCachingBackend class is used instead of RedisCachingBackend. Note that when dependencies are enabled, at least one instance of the Redis garbage collection must run. See RunGarbageCollector for details.

TransactionMaxRetries

Gets or sets the number of times Redis transactions are retried when they fail due to a data conflict, before an exception is raised. The default value is 5.

WriteCommandFlags

Gets or sets the Redis StackExchange.Redis.CommandFlags for write operations. The default value is StackExchange.Redis.CommandFlags.PreferMaster.

Methods

Name Description
Equals(CachingBackendConfiguration?)
Equals(RedisCachingBackendConfiguration?)
Equals(object?)
GetHashCode()
PrintMembers(StringBuilder)
ToString()

Operators

Name Description
operator ==(RedisCachingBackendConfiguration?, RedisCachingBackendConfiguration?)
operator !=(RedisCachingBackendConfiguration?, RedisCachingBackendConfiguration?)