Table of Contents

Struct LiteRtCache

Namespace
LiteRtLmSharp
Assembly
LiteRtLmSharp.dll

Where the engine keeps its compiled-artifact cache (GPU shaders / converted weights), which speeds up subsequent loads. Choose Default (next to the model file), Disabled, InMemory, or Directory(string) for an explicit path. Set it on Cache.

public readonly struct LiteRtCache : IEquatable<LiteRtCache>
Implements
Inherited Members

Remarks

Each mode is an explicit value, so a cache location can never be confused with a directory path that happens to look like a special token. The default value (default(LiteRtCache)) is Default.

Properties

Default

The engine default: write the cache next to the model file.

public static LiteRtCache Default { get; }

Property Value

LiteRtCache

Disabled

Disable the on-disk cache entirely.

public static LiteRtCache Disabled { get; }

Property Value

LiteRtCache

InMemory

Keep the cache in RAM only (CPU backend only; not available on Windows).

public static LiteRtCache InMemory { get; }

Property Value

LiteRtCache

Methods

Directory(string)

Use a specific directory for the cache.

public static LiteRtCache Directory(string path)

Parameters

path string

Returns

LiteRtCache

Exceptions

ArgumentException

path is null or empty, or starts with ':' — that prefix is reserved for the engine's special cache tokens (a real directory named e.g. ":memory" would silently become InMemory).

Equals(LiteRtCache)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(LiteRtCache other)

Parameters

other LiteRtCache

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToString()

A readable form: Default, Disabled, InMemory, or Directory(path).

public override string ToString()

Returns

string

Operators

operator ==(LiteRtCache, LiteRtCache)

Compares two cache settings by their native value.

public static bool operator ==(LiteRtCache left, LiteRtCache right)

Parameters

left LiteRtCache
right LiteRtCache

Returns

bool

operator !=(LiteRtCache, LiteRtCache)

Compares two cache settings by their native value.

public static bool operator !=(LiteRtCache left, LiteRtCache right)

Parameters

left LiteRtCache
right LiteRtCache

Returns

bool