pub struct AiCacheKey {
pub content_hash: u128,
pub model_id: u32,
pub task: Task,
pub params_version: u64,
}Expand description
Cache key. All fields are Copy, so lookups need no allocation and no
borrowed-key indirection.
content_hash: xxh3-128 of the input text (seecontent_hash).model_id: a stable per-model integer assigned by the caller (the registry), distinguishing models without hashing their names on lookup.params_version: a hash of the request parameters (seeparams_version).
Fields§
§content_hash: u128xxh3-128 hash of the input content.
model_id: u32Stable integer id of the model.
task: TaskThe task — a model can serve several (e.g. classify and sentiment), and they produce different outputs for the same input, so it must key the cache or results would collide across tasks.
params_version: u64Hash of the request parameters that affect the output.
Trait Implementations§
Source§impl Clone for AiCacheKey
impl Clone for AiCacheKey
Source§fn clone(&self) -> AiCacheKey
fn clone(&self) -> AiCacheKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AiCacheKey
impl Debug for AiCacheKey
Source§impl Hash for AiCacheKey
impl Hash for AiCacheKey
Source§impl PartialEq for AiCacheKey
impl PartialEq for AiCacheKey
Source§fn eq(&self, other: &AiCacheKey) -> bool
fn eq(&self, other: &AiCacheKey) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for AiCacheKey
impl Eq for AiCacheKey
impl StructuralPartialEq for AiCacheKey
Auto Trait Implementations§
impl Freeze for AiCacheKey
impl RefUnwindSafe for AiCacheKey
impl Send for AiCacheKey
impl Sync for AiCacheKey
impl Unpin for AiCacheKey
impl UnsafeUnpin for AiCacheKey
impl UnwindSafe for AiCacheKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more