Class CacheEntry
- Namespace
- Cuemon.Runtime.Caching
- Assembly
- Cuemon.Runtime.Caching.dll
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
key
StringThe unique identifier of the cache.
value
ObjectThe stored value of the cache.
ns
StringThe optional namespace that provides a scope to the cache.
Exceptions
- ArgumentNullException
key
cannot 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
- Boolean
true
if 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
time
DateTimeThe date and time to evaluate against.
Returns
- Boolean
true
if the specified time resolves this CacheEntry as expired; otherwise,false
.
OnExpiredRaised(CacheEntryEventArgs)
Raises the Expired event.
protected virtual void OnExpiredRaised(CacheEntryEventArgs e)
Parameters
e
CacheEntryEventArgsThe 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