pub struct RibbitCache { /* private fields */ }Expand description
Cache for Ribbit protocol responses
Implementations§
Source§impl RibbitCache
impl RibbitCache
Sourcepub fn cache_path(&self, region: &str, product: &str, endpoint: &str) -> PathBuf
pub fn cache_path(&self, region: &str, product: &str, endpoint: &str) -> PathBuf
Get cache path for a specific endpoint
Sourcepub fn metadata_path(
&self,
region: &str,
product: &str,
endpoint: &str,
) -> PathBuf
pub fn metadata_path( &self, region: &str, product: &str, endpoint: &str, ) -> PathBuf
Get metadata path for cache entry
Sourcepub async fn is_valid(
&self,
region: &str,
product: &str,
endpoint: &str,
) -> bool
pub async fn is_valid( &self, region: &str, product: &str, endpoint: &str, ) -> bool
Check if a cache entry exists and is still valid
Sourcepub async fn write(
&self,
region: &str,
product: &str,
endpoint: &str,
data: &[u8],
) -> Result<()>
pub async fn write( &self, region: &str, product: &str, endpoint: &str, data: &[u8], ) -> Result<()>
Write response to cache
Sourcepub async fn read(
&self,
region: &str,
product: &str,
endpoint: &str,
) -> Result<Vec<u8>>
pub async fn read( &self, region: &str, product: &str, endpoint: &str, ) -> Result<Vec<u8>>
Read response from cache
Sourcepub async fn clear_expired(&self) -> Result<()>
pub async fn clear_expired(&self) -> Result<()>
Clear expired entries from cache
Auto Trait Implementations§
impl Freeze for RibbitCache
impl RefUnwindSafe for RibbitCache
impl Send for RibbitCache
impl Sync for RibbitCache
impl Unpin for RibbitCache
impl UnwindSafe for RibbitCache
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