pub struct SegmentCache { /* private fields */ }Expand description
Bounded read-through cache. Without a disk configuration it remains a bounded in-memory cache; its default capacity is 64 MiB.
Implementations§
Source§impl SegmentCache
impl SegmentCache
Sourcepub fn memory_only(capacity_bytes: u64) -> Self
pub fn memory_only(capacity_bytes: u64) -> Self
Creates a byte-bounded memory-only cache.
Sourcepub fn open(config: &SegmentCacheConfig) -> Result<Self>
pub fn open(config: &SegmentCacheConfig) -> Result<Self>
Opens and reconciles an SSD cache, acquiring its exclusive ownership lock.
§Errors
Returns an error for invalid configuration, inaccessible storage, or when another process owns the directory.
Sourcepub fn metrics(&self) -> Arc<SegmentCacheMetrics>
pub fn metrics(&self) -> Arc<SegmentCacheMetrics>
Returns the cache’s metrics handle.
Sourcepub async fn get_or_load(
&self,
store: &dyn SegmentReader,
id: &BlobId,
) -> Result<Option<Arc<[u8]>>, StoreError>
pub async fn get_or_load( &self, store: &dyn SegmentReader, id: &BlobId, ) -> Result<Option<Arc<[u8]>>, StoreError>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SegmentCache
impl RefUnwindSafe for SegmentCache
impl Send for SegmentCache
impl Sync for SegmentCache
impl Unpin for SegmentCache
impl UnsafeUnpin for SegmentCache
impl UnwindSafe for SegmentCache
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