pub struct DiskCache { /* private fields */ }Expand description
L2 Disk Cache backed by RocksDB
Implementations§
Source§impl DiskCache
impl DiskCache
Sourcepub fn new(config: DiskCacheConfig) -> Result<Self>
pub fn new(config: DiskCacheConfig) -> Result<Self>
Create a new disk cache
Sourcepub fn put(&self, namespace: &str, vector: &Vector) -> Result<()>
pub fn put(&self, namespace: &str, vector: &Vector) -> Result<()>
Insert a vector into the cache
Sourcepub fn put_batch(&self, namespace: &str, vectors: &[Vector]) -> Result<usize>
pub fn put_batch(&self, namespace: &str, vectors: &[Vector]) -> Result<usize>
Insert multiple vectors into the cache
Sourcepub fn get(&self, namespace: &str, id: &VectorId) -> Result<Option<Vector>>
pub fn get(&self, namespace: &str, id: &VectorId) -> Result<Option<Vector>>
Get a vector from the cache
Sourcepub fn get_batch(
&self,
namespace: &str,
ids: &[VectorId],
) -> Result<Vec<Vector>>
pub fn get_batch( &self, namespace: &str, ids: &[VectorId], ) -> Result<Vec<Vector>>
Get multiple vectors from the cache
Sourcepub fn delete(&self, namespace: &str, id: &VectorId) -> Result<bool>
pub fn delete(&self, namespace: &str, id: &VectorId) -> Result<bool>
Delete a vector from the cache
Sourcepub fn delete_batch(&self, namespace: &str, ids: &[VectorId]) -> Result<usize>
pub fn delete_batch(&self, namespace: &str, ids: &[VectorId]) -> Result<usize>
Delete multiple vectors from the cache
Sourcepub fn clear_namespace(&self, namespace: &str) -> Result<usize>
pub fn clear_namespace(&self, namespace: &str) -> Result<usize>
Clear all entries in a namespace
Sourcepub fn approximate_size(&self) -> u64
pub fn approximate_size(&self) -> u64
Get approximate size of the cache in bytes
Sourcepub fn stats(&self) -> DiskCacheStats
pub fn stats(&self) -> DiskCacheStats
Get cache statistics
Auto Trait Implementations§
impl Freeze for DiskCache
impl RefUnwindSafe for DiskCache
impl Send for DiskCache
impl Sync for DiskCache
impl Unpin for DiskCache
impl UnsafeUnpin for DiskCache
impl UnwindSafe for DiskCache
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> 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