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§

source

fn cache_item_key<'a>(&self, url: &'a Url) -> Result<HttpCacheItemKey<'a>>

A pre-computed key for looking up items in the cache.

source

fn contains(&self, url: &Url) -> bool

source

fn set( &self, url: &Url, headers: HashMap<String, String>, content: &[u8], ) -> Result<()>

source

fn get( &self, key: &HttpCacheItemKey<'_>, maybe_checksum: Option<Checksum<'_>>, ) -> Result<Option<CacheEntry>, CacheReadFileError>

source

fn read_modified_time( &self, key: &HttpCacheItemKey<'_>, ) -> Result<Option<SystemTime>>

source

fn read_headers( &self, key: &HttpCacheItemKey<'_>, ) -> Result<Option<HashMap<String, String>>>

Reads the headers for the cache item.

source

fn read_download_time( &self, key: &HttpCacheItemKey<'_>, ) -> Result<Option<SystemTime>>

Reads the time the item was downloaded to the cache.

Implementors§