Class CacheEntry
- Namespace
- Akavache
- Assembly
- Akavache.dll
Represents an entry in a memory cache. The synthesized record equality is overridden so Value byte arrays are compared by content — two freshly allocated buffers carrying the same bytes compare equal.
public sealed record CacheEntry : IEquatable<CacheEntry>
- Inheritance
-
CacheEntry
- Implements
- Extension Methods
Constructors
CacheEntry(string?, string?, byte[]?, DateTimeOffset, DateTimeOffset?)
Represents an entry in a memory cache. The synthesized record equality is overridden so Value byte arrays are compared by content — two freshly allocated buffers carrying the same bytes compare equal.
public CacheEntry(string? Id, string? TypeName, byte[]? Value, DateTimeOffset CreatedAt, DateTimeOffset? ExpiresAt)
Parameters
IdstringThe cache entry's unique key.
TypeNamestringOptional type discriminator, stored alongside the row.
Valuebyte[]The serialized payload bytes.
CreatedAtDateTimeOffsetThe instant at which the entry was created.
ExpiresAtDateTimeOffset?Optional absolute expiration time. null means "never expires".
Properties
CreatedAt
The instant at which the entry was created.
public DateTimeOffset CreatedAt { get; init; }
Property Value
ExpiresAt
Optional absolute expiration time. null means "never expires".
public DateTimeOffset? ExpiresAt { get; init; }
Property Value
Id
The cache entry's unique key.
public string? Id { get; init; }
Property Value
TypeName
Optional type discriminator, stored alongside the row.
public string? TypeName { get; init; }
Property Value
Value
The serialized payload bytes.
public byte[]? Value { get; init; }
Property Value
- byte[]
Methods
Deconstruct(out string?, out string?, out byte[]?, out DateTimeOffset, out DateTimeOffset?)
public void Deconstruct(out string? Id, out string? TypeName, out byte[]? Value, out DateTimeOffset CreatedAt, out DateTimeOffset? ExpiresAt)
Parameters
IdstringTypeNamestringValuebyte[]CreatedAtDateTimeOffsetExpiresAtDateTimeOffset?
Equals(CacheEntry?)
public bool Equals(CacheEntry? other)
Parameters
otherCacheEntry
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(CacheEntry?, CacheEntry?)
public static bool operator ==(CacheEntry? left, CacheEntry? right)
Parameters
leftCacheEntryrightCacheEntry
Returns
operator !=(CacheEntry?, CacheEntry?)
public static bool operator !=(CacheEntry? left, CacheEntry? right)
Parameters
leftCacheEntryrightCacheEntry