Files
radicle-explorer/explorer/crates/radicle-httpd/src/cache.rs
T
Rūdolfs Ošiņš e37521c739 Move explorer into explorer/
Makes explorer and desktop sibling projects, as proposed in ADR 1.
This commit only moves files; paths in CI, scripts and docs are fixed
in the following commits.
2026-10-22 11:06:33 +02:00

23 lines
464 B
Rust

use std::num::NonZeroUsize;
use std::sync::Arc;
use lru::LruCache;
use tokio::sync::Mutex;
use radicle::prelude::RepoId;
use radicle_surf::Oid;
#[derive(Clone)]
pub struct Cache {
pub tree: Arc<Mutex<LruCache<(RepoId, Oid, String), serde_json::Value>>>,
}
impl Cache {
/// Creates a new cache of the given size.
pub fn new(size: NonZeroUsize) -> Self {
Cache {
tree: Arc::new(Mutex::new(LruCache::new(size))),
}
}
}