pub struct FragmentCache { /* private fields */ }Expand description
Two-tier fragment cache (memory + disk)
Implementations§
Source§impl FragmentCache
impl FragmentCache
Sourcepub async fn open(config: CacheConfig) -> Result<Self>
pub async fn open(config: CacheConfig) -> Result<Self>
Create or open a cache
Sourcepub async fn get(&self, fragment_id: &FragmentId) -> Option<Bytes>
pub async fn get(&self, fragment_id: &FragmentId) -> Option<Bytes>
Get a fragment from cache
Sourcepub async fn put(
&self,
fragment_id: FragmentId,
data: Bytes,
entry: CacheEntry,
) -> Result<()>
pub async fn put( &self, fragment_id: FragmentId, data: Bytes, entry: CacheEntry, ) -> Result<()>
Put a fragment into cache
Sourcepub fn contains(&self, fragment_id: &FragmentId) -> bool
pub fn contains(&self, fragment_id: &FragmentId) -> bool
Check if fragment exists in cache
Sourcepub fn get_entry(&self, fragment_id: &FragmentId) -> Option<CacheEntry>
pub fn get_entry(&self, fragment_id: &FragmentId) -> Option<CacheEntry>
Get cache entry metadata
Sourcepub fn needs_revalidation(
&self,
fragment_id: &FragmentId,
etag: Option<&str>,
) -> bool
pub fn needs_revalidation( &self, fragment_id: &FragmentId, etag: Option<&str>, ) -> bool
Validate cache entry against remote
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for FragmentCache
impl !RefUnwindSafe for FragmentCache
impl Send for FragmentCache
impl Sync for FragmentCache
impl Unpin for FragmentCache
impl UnwindSafe for FragmentCache
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