Open sandboxFocus

Class CachingProfile

Set of options defined at run time when the CachingService is instantiated. Classes and methods can be assigned to a CachingProfile using the ProfileName option or attribute property. Any compile-time setting takes precedence over the values defined in the CachingProfile.

Inheritance
CachingProfile
Namespace: Metalama.Patterns.Caching
Assembly: Metalama.Patterns.Caching.dll
Syntax
[RunTime]
public sealed class CachingProfile : ICacheItemConfiguration

Constructors

Name Description
CachingProfile(string)

Initializes a new instance of the CachingProfile class.

Fields

Name Description
DefaultName

The name of the default profile.

Properties

Name Description
AbsoluteExpiration

Gets or sets the total duration during which the result of the current method is stored in cache. The absolute expiration time is counted from the moment the method is evaluated and cached.

AcquireLockTimeout

Gets or sets the maximum time that the caching aspect will wait for the LockingStrategy to acquire a lock. To specify an infinite waiting time, set this property to TimeSpan.FromMilliseconds( -1 ). The default behavior is to wait infinitely.

AutoReload

Gets or sets a value indicating whether the method calls are automatically reloaded (by re-evaluating the target method with the same arguments) when the cache item is removed from the cache.

Backend

Gets the CachingBackend active for the current CachingProfile.

BackendFactory

Gets or sets a delegate creating the CachingBackend.

IsEnabled

Gets or sets a value indicating whether caching is enabled for the current profile.

LockingStrategy

Gets or sets the lock manager used to synchronize the execution of methods that are cached with the current profile. The default lock manager is NullLockingStrategy, which allows for concurrent execution of all methods. An alternative implementation is LocalLockingStrategy, which prevents concurrent execution of the same method with the same parameters, in the current process (or AppDomain).

Name

Gets the profile name (a case-insensitive string).

OnLockTimeout

Gets or sets the behavior in case that the caching aspect could not acquire a lock because of a timeout. The default behavior is to throw a TimeoutException. If the delegate does not return any exception, the cached method will be evaluated (even without a lock).

OwnsBackend

Gets or sets a value indicating whether the CachingService owns the Backend. The default value of this property is true if BackendFactory is non-null and false otherwise. When the profile owns the CachingBackend, When the backend is owned, the CachingService will initialize it and dispose it. Otherwise, this should be performed by the caller.

Priority

Gets or sets the priority of the cached methods.

SlidingExpiration

Gets or sets the duration during which the result of the current method is stored in cache after it has been added to or accessed from the cache. The expiration is extended every time the value is accessed from the cache.