tower_http_cache_plus/cache/implementation/moka/
builder.rs1use super::{
2 super::super::{key::*, response::*},
3 expiry::*,
4 weigher::*,
5};
6
7pub trait ForHttpResponse
13where
14 Self: Sized,
15{
16 fn for_http_response(self) -> Self;
18}
19
20impl<CacheKeyT> ForHttpResponse
21 for moka::future::CacheBuilder<CacheKeyT, CachedResponseRef, moka::future::Cache<CacheKeyT, CachedResponseRef>>
22where
23 CacheKeyT: CacheKey,
24{
25 fn for_http_response(self) -> Self {
26 self.weigher(weigher).expire_after(CachedResponseExpiry)
27 }
28}