Class CacheEntry
Represents an individual cache entry in the cache.
public class CacheEntry
- Inheritance
-
CacheEntry
Constructors
CacheEntry(string, object, string)
Initializes a new instance of the CacheEntry class.
public CacheEntry(string key, object value, string ns = null)
Parameters
keystringThe unique identifier of the cache.
valueobjectThe stored value of the cache.
nsstringThe optional namespace that provides a scope to the cache.
Exceptions
- ArgumentNullException
keycannot be null.
Fields
NoScope
Represents a cache with a global scope, eg. no namespace.
public const string NoScope = null
Field Value
Properties
Accessed
Gets the UTC date time value from when this CacheEntry was last accessed.
public DateTime Accessed { get; }
Property Value
- DateTime
The UTC date time value from when this CacheEntry was last accessed.
CanExpire
Gets a value indicating whether this CacheEntry can expire.
public bool CanExpire { get; }
Property Value
- bool
trueif this CacheEntry can expire; otherwise,false.
Inserted
Gets the UTC date time value from when this CacheEntry was inserted.
public DateTime Inserted { get; }
Property Value
- DateTime
The UTC date time value from when this CacheEntry was inserted.
Invalidation
Gets the cache invalidation of this CacheEntry.
public CacheInvalidation Invalidation { get; }
Property Value
- CacheInvalidation
The cache invalidation of this CacheEntry.
Key
Gets the unique identifier of this CacheEntry.
public string Key { get; }
Property Value
- string
The unique identifier of this CacheEntry.
Namespace
Gets the optional namespace that provides a scope to this CacheEntry.
public string Namespace { get; }
Property Value
- string
The optional namespace that provides a scope to this CacheEntry.
Value
Gets the stored value of this CacheEntry.
public object Value { get; set; }
Property Value
- object
The stored value of this CacheEntry.
Methods
HasExpired(DateTime)
Determines whether the specified time resolves this CacheEntry as expired.
public bool HasExpired(DateTime time)
Parameters
timeDateTimeThe date and time to evaluate against.
Returns
- bool
trueif the specified time resolves this CacheEntry as expired; otherwise,false.
OnExpiredRaised(CacheEntryEventArgs)
Raises the Expired event.
protected virtual void OnExpiredRaised(CacheEntryEventArgs e)
Parameters
eCacheEntryEventArgsThe CacheEntryEventArgs instance containing the event data.
ToString()
Returns a string that represents this instance.
public override string ToString()
Returns
Events
Expired
Occurs when a CacheEntry object with an associated Dependency has expired.
public event EventHandler<CacheEntryEventArgs> Expired