Skip to main content

micro_moka/
policy.rs

1#[derive(Clone, Debug)]
2/// The policy of a cache.
3pub struct Policy {
4    max_capacity: Option<u64>,
5}
6
7impl Policy {
8    pub(crate) fn new(max_capacity: Option<u64>) -> Self {
9        Self { max_capacity }
10    }
11
12    /// Returns the `max_capacity` of the cache.
13    pub fn max_capacity(&self) -> Option<u64> {
14        self.max_capacity
15    }
16}