LockingCacheOptions Class

Represents the options for creating a thread-safe accessor by the ThreadSafeCacheFactory.Create<TKey, TValue> methods.
To see when to use LockFreeCacheOptions or LockingCacheOptions see the Remarks section of the CreateTKey, TValue(FuncTKey, TValue, IEqualityComparerTKey, ThreadSafeCacheOptionsBase) method.

Definition

Namespace: KGySoft.Collections
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.1.0
C#
public sealed class LockingCacheOptions : ThreadSafeCacheOptionsBase
Inheritance
Object    ThreadSafeCacheOptionsBase    LockingCacheOptions

Constructors

LockingCacheOptionsInitializes a new instance of the LockingCacheOptions class

Properties

Behavior Gets or sets the cache behavior when cache is full and an element has to be removed. The cache is full, when the number of stored items reaches Capacity. Default value: RemoveLeastRecentUsedElement.
Capacity Gets or sets the capacity of the cache to be created. If the cache is full, then the oldest or the least recent used element (depending on the Behavior property) will be dropped from the cache.
Default value: 1024.
DisposeDroppedValues Gets or sets whether dropped values are disposed if they implement IDisposable.
Default value: .
Expiration Gets or sets an expiration time for the values to be stored in the cache. If , then the values will not expire.
Default value: .
PreallocateCapacity Gets or sets whether adding the first item to the cache should allocate memory for the full cache Capacity. If , then the internal storage is dynamically reallocated while adding new elements until reaching Capacity. Set it to if it is almost certain that the cache will be full when using it.
Default value: .
ProtectItemLoader Gets or sets whether the item loader delegate that is specified by the ThreadSafeCacheFactory.Create<TKey, TValue> methods should be protected from invoking it concurrently.
Default value: .

Extension Methods

Convert Converts an Object specified in the obj parameter to the desired targetType.
See the Examples section of the generic ConvertTTarget(Object, CultureInfo) overload for an example.
(Defined by ObjectExtensions)
ConvertTTarget Converts an Object specified in the obj parameter to the desired TTarget.
(Defined by ObjectExtensions)
In Gets whether item is among the elements of set.
See the Examples section of the generic InT(T, T) overload for an example.
(Defined by ObjectExtensions)
TryConvert Tries to convert an Object specified in the obj parameter to the desired targetType.
See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example.
(Defined by ObjectExtensions)
TryConvert Tries to convert an Object specified in the obj parameter to the desired targetType.
See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example.
(Defined by ObjectExtensions)
TryConvertTTarget Tries to convert an Object specified in the obj parameter to the desired TTarget.
See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example.
(Defined by ObjectExtensions)
TryConvertTTarget Tries to convert an Object specified in the obj parameter to the desired TTarget.
See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example.
(Defined by ObjectExtensions)

See Also