pub struct WeakLanceCache { /* private fields */ }
Expand description
A weak reference to a LanceCache, used by indices to avoid circular references. When the original cache is dropped, operations on this will gracefully no-op.
Implementations§
Source§impl WeakLanceCache
impl WeakLanceCache
Sourcepub fn from(cache: &LanceCache) -> Self
pub fn from(cache: &LanceCache) -> Self
Create a weak reference from a strong LanceCache
Sourcepub fn with_key_prefix(&self, prefix: &str) -> Self
pub fn with_key_prefix(&self, prefix: &str) -> Self
Appends a prefix to the cache key
Sourcepub async fn get<T: DeepSizeOf + Send + Sync + 'static>(
&self,
key: &str,
) -> Option<Arc<T>>
pub async fn get<T: DeepSizeOf + Send + Sync + 'static>( &self, key: &str, ) -> Option<Arc<T>>
Get an item from cache if the cache is still alive
Sourcepub async fn insert<T: DeepSizeOf + Send + Sync + 'static>(
&self,
key: &str,
value: Arc<T>,
) -> bool
pub async fn insert<T: DeepSizeOf + Send + Sync + 'static>( &self, key: &str, value: Arc<T>, ) -> bool
Insert an item if the cache is still alive Returns true if the item was inserted, false if the cache is no longer available
Sourcepub async fn get_or_insert<T, F, Fut>(&self, key: &str, f: F) -> Result<Arc<T>>
pub async fn get_or_insert<T, F, Fut>(&self, key: &str, f: F) -> Result<Arc<T>>
Get or insert an item, computing it if necessary
Sourcepub async fn get_or_insert_with_key<K, F, Fut>(
&self,
cache_key: K,
loader: F,
) -> Result<Arc<K::ValueType>>
pub async fn get_or_insert_with_key<K, F, Fut>( &self, cache_key: K, loader: F, ) -> Result<Arc<K::ValueType>>
Get or insert an item with a cache key type
Sourcepub async fn insert_with_key<K>(
&self,
cache_key: &K,
value: Arc<K::ValueType>,
) -> bool
pub async fn insert_with_key<K>( &self, cache_key: &K, value: Arc<K::ValueType>, ) -> bool
Insert with a cache key type Returns true if the item was inserted, false if the cache is no longer available
Sourcepub async fn get_with_key<K>(&self, cache_key: &K) -> Option<Arc<K::ValueType>>
pub async fn get_with_key<K>(&self, cache_key: &K) -> Option<Arc<K::ValueType>>
Get with a cache key type
Sourcepub async fn get_unsized<T: DeepSizeOf + Send + Sync + 'static + ?Sized>(
&self,
key: &str,
) -> Option<Arc<T>>
pub async fn get_unsized<T: DeepSizeOf + Send + Sync + 'static + ?Sized>( &self, key: &str, ) -> Option<Arc<T>>
Get unsized item from cache
Sourcepub async fn insert_unsized<T: DeepSizeOf + Send + Sync + 'static + ?Sized>(
&self,
key: &str,
value: Arc<T>,
)
pub async fn insert_unsized<T: DeepSizeOf + Send + Sync + 'static + ?Sized>( &self, key: &str, value: Arc<T>, )
Insert unsized item into cache
Sourcepub async fn get_unsized_with_key<K>(
&self,
cache_key: &K,
) -> Option<Arc<K::ValueType>>
pub async fn get_unsized_with_key<K>( &self, cache_key: &K, ) -> Option<Arc<K::ValueType>>
Get unsized with a cache key type
Sourcepub async fn insert_unsized_with_key<K>(
&self,
cache_key: &K,
value: Arc<K::ValueType>,
)
pub async fn insert_unsized_with_key<K>( &self, cache_key: &K, value: Arc<K::ValueType>, )
Insert unsized with a cache key type
Trait Implementations§
Source§impl Clone for WeakLanceCache
impl Clone for WeakLanceCache
Source§fn clone(&self) -> WeakLanceCache
fn clone(&self) -> WeakLanceCache
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for WeakLanceCache
impl !RefUnwindSafe for WeakLanceCache
impl Send for WeakLanceCache
impl Sync for WeakLanceCache
impl Unpin for WeakLanceCache
impl !UnwindSafe for WeakLanceCache
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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>
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