Class CacheEntry
- Namespace
- OpenSettings.Models
- Assembly
- OpenSettings.dll
Represents a model for organizing and tracking memory cache keys.
This class is designed to track cache keys in a more organized manner, supporting operations like managing cache key parts and reusing cache details efficiently.
The CacheEntry class provides functionality for concatenating cache key parts, storing cache keys, and organizing them using a concurrent dictionary for better performance and thread safety.
public class CacheEntry
- Inheritance
-
CacheEntry
- Inherited Members
Constructors
CacheEntry(object, TimeSpan?, TimeSpan?)
Initializes a new instance of the CacheEntry class with the specified key and relative expiration time, and sliding expiration time.
public CacheEntry(object baseKey, TimeSpan? absoluteExpirationRelativeToNow, TimeSpan? slidingExpiration)
Parameters
baseKeyobjectThe key used to identify the cache entry.
absoluteExpirationRelativeToNowTimeSpan?The relative expiration time after which the cache entry will expire.
slidingExpirationTimeSpan?The sliding expiration time after which the cache entry will expire if not accessed.
CacheEntry(params object[])
Initializes a new instance of the CacheEntry class with the specified key parts.
public CacheEntry(params object[] keyParts)
Parameters
keyPartsobject[]An array of key parts used to identify the cache entry.
Exceptions
- ArgumentNullException
Thrown if the
keyPartsis null.
CacheEntry(object[], DateTimeOffset?)
Initializes a new instance of the CacheEntry class with the specified key parts and absolute expiration date.
public CacheEntry(object[] keyParts, DateTimeOffset? absoluteExpiration)
Parameters
keyPartsobject[]An array of key parts used to identify the cache entry.
absoluteExpirationDateTimeOffset?The absolute expiration date after which the cache entry will expire.
CacheEntry(object[], DateTimeOffset?, TimeSpan?)
Initializes a new instance of the CacheEntry class with the specified key parts, absolute expiration date, and sliding expiration time.
public CacheEntry(object[] keyParts, DateTimeOffset? absoluteExpiration, TimeSpan? slidingExpiration)
Parameters
keyPartsobject[]An array of key parts used to identify the cache entry.
absoluteExpirationDateTimeOffset?The absolute expiration date after which the cache entry will expire.
slidingExpirationTimeSpan?The sliding expiration time after which the cache entry will expire if not accessed.
CacheEntry(object[], TimeSpan?)
Initializes a new instance of the CacheEntry class with the specified key parts and relative expiration time.
public CacheEntry(object[] keyParts, TimeSpan? absoluteExpirationRelativeToNow)
Parameters
keyPartsobject[]An array of key parts used to identify the cache entry.
absoluteExpirationRelativeToNowTimeSpan?The relative expiration time after which the cache entry will expire.
CacheEntry(object[], TimeSpan?, TimeSpan?)
Initializes a new instance of the CacheEntry class with the specified key parts, relative expiration time, and sliding expiration time.
public CacheEntry(object[] keyParts, TimeSpan? absoluteExpirationRelativeToNow, TimeSpan? slidingExpiration)
Parameters
keyPartsobject[]An array of key parts used to identify the cache entry.
absoluteExpirationRelativeToNowTimeSpan?The relative expiration time after which the cache entry will expire.
slidingExpirationTimeSpan?The sliding expiration time after which the cache entry will expire if not accessed.
CacheEntry(string)
public CacheEntry(string baseKey)
Parameters
baseKeystring
CacheEntry(string, DateTimeOffset?)
Initializes a new instance of the CacheEntry class with the specified key and absolute expiration date.
public CacheEntry(string baseKey, DateTimeOffset? absoluteExpiration)
Parameters
baseKeystringThe key used to identify the cache entry.
absoluteExpirationDateTimeOffset?The absolute expiration date after which the cache entry will expire.
CacheEntry(string, DateTimeOffset?, TimeSpan?)
Initializes a new instance of the CacheEntry class with the specified key, absolute expiration date, and sliding expiration time.
public CacheEntry(string baseKey, DateTimeOffset? absoluteExpiration, TimeSpan? slidingExpiration)
Parameters
baseKeystringThe key used to identify the cache entry.
absoluteExpirationDateTimeOffset?The absolute expiration date after which the cache entry will expire.
slidingExpirationTimeSpan?The sliding expiration time after which the cache entry will expire if not accessed.
CacheEntry(string, TimeSpan?)
Initializes a new instance of the CacheEntry class with the specified key and relative expiration time.
public CacheEntry(string baseKey, TimeSpan? absoluteExpirationRelativeToNow)
Parameters
baseKeystringThe key used to identify the cache entry.
absoluteExpirationRelativeToNowTimeSpan?The relative expiration time after which the cache entry will expire.
Properties
BaseKey
public string BaseKey { get; }
Property Value
Options
public MemoryCacheEntryOptions Options { get; }
Property Value
Methods
GetKey(params object[])
Generates a cache key based on the base key and provided key parts.
public CacheEntryKey GetKey(params object[] keyParts)
Parameters
keyPartsobject[]Additional key parts.