Table of Contents

Class SlimMemoryCacheOptions

Namespace
Cuemon.Runtime.Caching
Assembly
Cuemon.Runtime.Caching.dll

Configuration options for SlimMemoryCache.

public class SlimMemoryCacheOptions : IValidatableParameterObject, IParameterObject
Inheritance
SlimMemoryCacheOptions
Implements

Constructors

SlimMemoryCacheOptions()

Initializes a new instance of the SlimMemoryCacheOptions class.

public SlimMemoryCacheOptions()

Remarks

The following table shows the initial property values for an instance of SlimMemoryCacheOptions.

PropertyInitial Value
EnableCleanuptrue
FirstSweepAfter 30 seconds
SucceedingSweepEvery 2 minutes
KeyProvider(key, ns) => Generate.HashCode64(ns == Cache.NoScope ? key.ToUpperInvariant() : $"{key}^{nameof(SlimMemoryCache)}^{ns}".ToUpperInvariant());

Properties

EnableCleanup

Gets or sets a value indicating whether a periodic sweep clean-up is done on the cache.

public bool EnableCleanup { get; set; }

Property Value

Boolean

true if a periodic sweep clean-up is done on the cache; otherwise, false.

FirstSweep

Gets or sets the TimeSpan that specifies the amount of time to wait before the initial first sweep clean-up.

public TimeSpan FirstSweep { get; set; }

Property Value

TimeSpan

The TimeSpan that specifies the amount of time to wait before the initial first sweep clean-up.

KeyProvider

Gets or sets the function delegate that is responsible for providing a unique identifier for a cache entry.

public Func<string, string, long> KeyProvider { get; set; }

Property Value

Func<String, String, Int64>

The function delegate that is responsible for providing a unique identifier for a cache entry.

SucceedingSweep

Gets or sets the TimeSpan that specifies the interval for every succeeding sweep clean-up after the initial FirstSweep.

public TimeSpan SucceedingSweep { get; set; }

Property Value

TimeSpan

The TimeSpan that specifies the interval for every succeeding sweep clean-up.

Methods

ValidateOptions()

Determines whether the public read-write properties of this instance are in a valid state.

public void ValidateOptions()

Remarks

This method is expected to throw exceptions when one or more conditions fails to be in a valid state.

Exceptions

InvalidOperationException

KeyProvider cannot be null.