pub trait HttpCache:
Send
+ Sync
+ Any {
// Required methods
fn policy(
&'static self,
key: CacheKey,
) -> Pin<Box<dyn Future<Output = Option<CachePolicy>> + Send>>;
fn set_policy(
&'static self,
key: CacheKey,
policy: CachePolicy,
) -> Pin<Box<dyn Future<Output = bool> + Send>>;
fn body(
&'static self,
key: CacheKey,
) -> Pin<Box<dyn Future<Output = Option<IpcBytes>> + Send>>;
fn set(
&'static self,
key: CacheKey,
policy: CachePolicy,
body: IpcBytes,
) -> Pin<Box<dyn Future<Output = ()> + Send>>;
fn remove(
&'static self,
key: CacheKey,
) -> Pin<Box<dyn Future<Output = ()> + Send>>;
fn cookie(
&'static self,
uri: Uri,
) -> Pin<Box<dyn Future<Output = Option<HeaderValue>> + Send>>;
fn set_cookie(
&'static self,
uri: Uri,
cookie: HeaderValue,
) -> Pin<Box<dyn Future<Output = ()> + Send>>;
fn remove_cookie(
&'static self,
uri: Uri,
) -> Pin<Box<dyn Future<Output = ()> + Send>>;
fn purge(&'static self) -> Pin<Box<dyn Future<Output = ()> + Send>>;
fn prune(&'static self) -> Pin<Box<dyn Future<Output = ()> + Send>>;
}Expand description
HTTP cache backend.
Cache implementers must store a CachePolicy and IpcBytes body for a given CacheKey.
Required Methods§
Sourcefn policy(
&'static self,
key: CacheKey,
) -> Pin<Box<dyn Future<Output = Option<CachePolicy>> + Send>>
fn policy( &'static self, key: CacheKey, ) -> Pin<Box<dyn Future<Output = Option<CachePolicy>> + Send>>
Get the cache-policy for the given key.
Sourcefn set_policy(
&'static self,
key: CacheKey,
policy: CachePolicy,
) -> Pin<Box<dyn Future<Output = bool> + Send>>
fn set_policy( &'static self, key: CacheKey, policy: CachePolicy, ) -> Pin<Box<dyn Future<Output = bool> + Send>>
Replaces the cache-policy for the given key.
Returns false if the entry does not exist.
Sourcefn body(
&'static self,
key: CacheKey,
) -> Pin<Box<dyn Future<Output = Option<IpcBytes>> + Send>>
fn body( &'static self, key: CacheKey, ) -> Pin<Box<dyn Future<Output = Option<IpcBytes>> + Send>>
Get the cached body for the given key.
Sourcefn set(
&'static self,
key: CacheKey,
policy: CachePolicy,
body: IpcBytes,
) -> Pin<Box<dyn Future<Output = ()> + Send>>
fn set( &'static self, key: CacheKey, policy: CachePolicy, body: IpcBytes, ) -> Pin<Box<dyn Future<Output = ()> + Send>>
Caches the policy and body for the given key.
Sourcefn remove(
&'static self,
key: CacheKey,
) -> Pin<Box<dyn Future<Output = ()> + Send>>
fn remove( &'static self, key: CacheKey, ) -> Pin<Box<dyn Future<Output = ()> + Send>>
Remove cache policy and body for the given key.
Get the Cookie value associated with the uri.
The returned value is validated and ready for sending.
Store the Set-Cookie value associated with the uri.
The uri and cookie must be directly from the response, the cache will parse and property associate the cookie with domain.
Remove the Cookie value associated with the uri.