Table of Contents

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

Id string

The cache entry's unique key.

TypeName string

Optional type discriminator, stored alongside the row.

Value byte[]

The serialized payload bytes.

CreatedAt DateTimeOffset

The instant at which the entry was created.

ExpiresAt DateTimeOffset?

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

DateTimeOffset

ExpiresAt

Optional absolute expiration time. null means "never expires".

public DateTimeOffset? ExpiresAt { get; init; }

Property Value

DateTimeOffset?

Id

The cache entry's unique key.

public string? Id { get; init; }

Property Value

string

TypeName

Optional type discriminator, stored alongside the row.

public string? TypeName { get; init; }

Property Value

string

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

Id string
TypeName string
Value byte[]
CreatedAt DateTimeOffset
ExpiresAt DateTimeOffset?

Equals(CacheEntry?)

public bool Equals(CacheEntry? other)

Parameters

other CacheEntry

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

Operators

operator ==(CacheEntry?, CacheEntry?)

public static bool operator ==(CacheEntry? left, CacheEntry? right)

Parameters

left CacheEntry
right CacheEntry

Returns

bool

operator !=(CacheEntry?, CacheEntry?)

public static bool operator !=(CacheEntry? left, CacheEntry? right)

Parameters

left CacheEntry
right CacheEntry

Returns

bool