1use std::time::Duration;
2
3#[derive(Clone, Debug)]
4pub struct Policy {
6 max_capacity: Option<u64>,
7 time_to_live: Option<Duration>,
8 time_to_idle: Option<Duration>,
9}
10
11impl Policy {
12 pub(crate) fn new(
13 max_capacity: Option<u64>,
14 time_to_live: Option<Duration>,
15 time_to_idle: Option<Duration>,
16 ) -> Self {
17 Self {
18 max_capacity,
19 time_to_live,
20 time_to_idle,
21 }
22 }
23
24 pub fn max_capacity(&self) -> Option<u64> {
26 self.max_capacity
27 }
28
29 pub fn time_to_live(&self) -> Option<Duration> {
31 self.time_to_live
32 }
33
34 pub fn time_to_idle(&self) -> Option<Duration> {
36 self.time_to_idle
37 }
38}