intrepid_model/caches/
cache_repo.rs1use super::{Cache, CacheRecord, IntoCache};
2
3#[derive(Debug, thiserror::Error)]
5pub enum CacheRepoError {
6 #[error("Unable to set cache record")]
8 SetFailed,
9}
10
11#[async_trait::async_trait]
14pub trait CacheRepo {
15 async fn get_memo(
17 &self,
18 uri: impl AsRef<str> + Send,
19 ) -> Result<Cache<CacheRecord>, CacheRepoError>;
20
21 async fn set_memo<CacheCandidate>(
23 &self,
24 record: CacheCandidate,
25 ) -> Result<CacheRecord, CacheRepoError>
26 where
27 CacheCandidate: IntoCache + Send;
28}