2ae9196
ZhenYi
feat(lib/git): add HTTP handler tree with routes and errors across analysis, archives, blobs, branches, commits, conflicts, content, diffs, hooks, lfs, logs, maintenance, packs, patches, pipelines, refs, remotes, repos, signatures, submodules, tags, trees
2ae9196
use crate::context::facade::GitContext;
impl GitContext {
pub async fn cache_insert<V>(
&self,
key: &str,
value: &V,
ttl: Option<std::time::Duration>,
) -> Result<(), crate::share::errors::GitError>
where
V: serde::Serialize,
{
Ok(self.cache.set(key, value, ttl).await?)
}
pub async fn cache_get<V>(&self, key: &str) -> Result<Option<V>, crate::share::errors::GitError>
where
V: serde::de::DeserializeOwned,
{
Ok(self.cache.get(key).await?)
}
pub async fn cache_remove(&self, key: &str) -> Result<(), crate::share::errors::GitError> {
Ok(self.cache.delete(key).await?)
}
pub async fn cache_exists(&self, key: &str) -> Result<bool, crate::share::errors::GitError> {
Ok(self.cache.exists(key).await?)
}
}