Trait deno_cache_dir::HttpCache
source · pub trait HttpCache:
Send
+ Sync
+ Debug {
// Required methods
fn cache_item_key<'a>(&self, url: &'a Url) -> Result<HttpCacheItemKey<'a>>;
fn contains(&self, url: &Url) -> bool;
fn set(
&self,
url: &Url,
headers: HashMap<String, String>,
content: &[u8],
) -> Result<()>;
fn get(
&self,
key: &HttpCacheItemKey<'_>,
maybe_checksum: Option<Checksum<'_>>,
) -> Result<Option<CacheEntry>, CacheReadFileError>;
fn read_modified_time(
&self,
key: &HttpCacheItemKey<'_>,
) -> Result<Option<SystemTime>>;
fn read_headers(
&self,
key: &HttpCacheItemKey<'_>,
) -> Result<Option<HashMap<String, String>>>;
fn read_download_time(
&self,
key: &HttpCacheItemKey<'_>,
) -> Result<Option<SystemTime>>;
}Required Methods§
sourcefn cache_item_key<'a>(&self, url: &'a Url) -> Result<HttpCacheItemKey<'a>>
fn cache_item_key<'a>(&self, url: &'a Url) -> Result<HttpCacheItemKey<'a>>
A pre-computed key for looking up items in the cache.
fn contains(&self, url: &Url) -> bool
fn set( &self, url: &Url, headers: HashMap<String, String>, content: &[u8], ) -> Result<()>
fn get( &self, key: &HttpCacheItemKey<'_>, maybe_checksum: Option<Checksum<'_>>, ) -> Result<Option<CacheEntry>, CacheReadFileError>
fn read_modified_time( &self, key: &HttpCacheItemKey<'_>, ) -> Result<Option<SystemTime>>
sourcefn read_headers(
&self,
key: &HttpCacheItemKey<'_>,
) -> Result<Option<HashMap<String, String>>>
fn read_headers( &self, key: &HttpCacheItemKey<'_>, ) -> Result<Option<HashMap<String, String>>>
Reads the headers for the cache item.
sourcefn read_download_time(
&self,
key: &HttpCacheItemKey<'_>,
) -> Result<Option<SystemTime>>
fn read_download_time( &self, key: &HttpCacheItemKey<'_>, ) -> Result<Option<SystemTime>>
Reads the time the item was downloaded to the cache.