Table of Contents

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

baseKey object

The key used to identify the cache entry.

absoluteExpirationRelativeToNow TimeSpan?

The relative expiration time after which the cache entry will expire.

slidingExpiration TimeSpan?

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

keyParts object[]

An array of key parts used to identify the cache entry.

Exceptions

ArgumentNullException

Thrown if the keyParts is 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

keyParts object[]

An array of key parts used to identify the cache entry.

absoluteExpiration DateTimeOffset?

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

keyParts object[]

An array of key parts used to identify the cache entry.

absoluteExpiration DateTimeOffset?

The absolute expiration date after which the cache entry will expire.

slidingExpiration TimeSpan?

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

keyParts object[]

An array of key parts used to identify the cache entry.

absoluteExpirationRelativeToNow TimeSpan?

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

keyParts object[]

An array of key parts used to identify the cache entry.

absoluteExpirationRelativeToNow TimeSpan?

The relative expiration time after which the cache entry will expire.

slidingExpiration TimeSpan?

The sliding expiration time after which the cache entry will expire if not accessed.

CacheEntry(string)

public CacheEntry(string baseKey)

Parameters

baseKey string

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

baseKey string

The key used to identify the cache entry.

absoluteExpiration DateTimeOffset?

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

baseKey string

The key used to identify the cache entry.

absoluteExpiration DateTimeOffset?

The absolute expiration date after which the cache entry will expire.

slidingExpiration TimeSpan?

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

baseKey string

The key used to identify the cache entry.

absoluteExpirationRelativeToNow TimeSpan?

The relative expiration time after which the cache entry will expire.

Properties

BaseKey

public string BaseKey { get; }

Property Value

string

Options

public MemoryCacheEntryOptions Options { get; }

Property Value

MemoryCacheEntryOptions

Methods

GetKey(params object[])

Generates a cache key based on the base key and provided key parts.

public CacheEntryKey GetKey(params object[] keyParts)

Parameters

keyParts object[]

Additional key parts.

Returns

CacheEntryKey