pub struct VectorCache { /* private fields */ }Expand description
L1 in-memory vector cache
Implementations§
Source§impl VectorCache
impl VectorCache
Sourcepub fn new(config: CacheConfig) -> Self
pub fn new(config: CacheConfig) -> Self
Create a new cache with the given configuration
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default configuration
Sourcepub async fn get(&self, namespace: &str, vector_id: &str) -> Option<Arc<Vector>>
pub async fn get(&self, namespace: &str, vector_id: &str) -> Option<Arc<Vector>>
Get a vector from the cache
Sourcepub async fn insert_batch(&self, namespace: &str, vectors: Vec<Vector>)
pub async fn insert_batch(&self, namespace: &str, vectors: Vec<Vector>)
Insert multiple vectors into the cache
Sourcepub async fn remove_batch(&self, namespace: &str, vector_ids: &[String])
pub async fn remove_batch(&self, namespace: &str, vector_ids: &[String])
Remove multiple vectors from the cache
Sourcepub async fn invalidate_namespace(&self, namespace: &str)
pub async fn invalidate_namespace(&self, namespace: &str)
Invalidate all entries for a namespace.
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics
Sourcepub async fn run_pending_tasks(&self)
pub async fn run_pending_tasks(&self)
Run pending maintenance tasks (eviction, etc.)
Trait Implementations§
Source§impl Clone for VectorCache
impl Clone for VectorCache
Source§fn clone(&self) -> VectorCache
fn clone(&self) -> VectorCache
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for VectorCache
impl !RefUnwindSafe for VectorCache
impl Send for VectorCache
impl Sync for VectorCache
impl Unpin for VectorCache
impl UnsafeUnpin for VectorCache
impl !UnwindSafe for VectorCache
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,
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>
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