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.
To see when to use LockFreeCacheOptions or LockingCacheOptions see the Remarks section. of the CreateTKey, TValue(FuncTKey, TValue, IEqualityComparerTKey, ThreadSafeCacheOptionsBase) method.
Inheritance Hierarchy
KGySoft.CollectionsThreadSafeCacheOptionsBase
KGySoft.CollectionsLockingCacheOptions
Namespace: KGySoft.Collections
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 7.0.0-preview.3
Syntax
The LockingCacheOptions type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() | LockingCacheOptions | Initializes a new instance of the LockingCacheOptions class |
Properties
Name | Description | |
---|---|---|
![]() | 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 | |
![]() | 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: . Remarks Even if this property is , values might be reloaded from time to time because if the cache is full (see Capacity) oldest or least recent used elements (see Behavior) are dropped from the cache. Depending on the targeted platform it is possible that values will not expire for at least 15 milliseconds. |
![]() | PreallocateCapacity |
Gets or sets whether adding the first item to the cache should allocate memory 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 is protected from invoking it concurrently.
Default value: . |
Extension Methods
Name | Description | |
---|---|---|
![]() | Convert(Type, CultureInfo) | Overloaded.
Converts an Object specified in the obj parameter to the desired targetType.
(Defined by ObjectExtensions.)See the Examples section of the generic ConvertTTarget(Object, CultureInfo) overload for an example. |
![]() ![]() | ConvertTTarget(CultureInfo) | Overloaded.
Converts an Object specified in the obj parameter to the desired TTarget.
(Defined by ObjectExtensions.)See the Remarks section for details. |
![]() | In |
Gets whether item is among the elements of set.
(Defined by ObjectExtensions.)See the Examples section of the generic InT(T, T) overload for an example. |
![]() | TryConvert(Type, Object) | Overloaded.
Tries to convert an Object specified in the obj parameter to the desired targetType.
(Defined by ObjectExtensions.)See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example. |
![]() | TryConvert(Type, CultureInfo, Object) | Overloaded.
Tries to convert an Object specified in the obj parameter to the desired targetType.
(Defined by ObjectExtensions.)See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example. |
![]() | TryConvertTTarget(TTarget) | Overloaded.
Tries to convert an Object specified in the obj parameter to the desired TTarget.
(Defined by ObjectExtensions.)See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example. |
![]() | TryConvertTTarget(CultureInfo, TTarget) | Overloaded.
Tries to convert an Object specified in the obj parameter to the desired TTarget.
(Defined by ObjectExtensions.)See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example. |
See Also