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
Disabled
Disable the on-disk cache entirely.
public static LiteRtCache Disabled { get; }
Property Value
InMemory
Keep the cache in RAM only (CPU backend only; not available on Windows).
public static LiteRtCache InMemory { get; }
Property Value
Methods
Directory(string)
Use a specific directory for the cache.
public static LiteRtCache Directory(string path)
Parameters
pathstring
Returns
Exceptions
- ArgumentException
pathis 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
otherLiteRtCacheAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
Operators
operator ==(LiteRtCache, LiteRtCache)
Compares two cache settings by their native value.
public static bool operator ==(LiteRtCache left, LiteRtCache right)
Parameters
leftLiteRtCacherightLiteRtCache
Returns
operator !=(LiteRtCache, LiteRtCache)
Compares two cache settings by their native value.
public static bool operator !=(LiteRtCache left, LiteRtCache right)
Parameters
leftLiteRtCacherightLiteRtCache