A better Rust ATProto crate
1

Configure Feed

Select the types of activity you want to include in your feed.

at main 882 B View raw
1use std::time::Duration; 2 3#[derive(Clone, Debug)] 4/// The policy of a cache. 5pub 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 /// Returns the `max_capacity` of the cache. 25 pub fn max_capacity(&self) -> Option<u64> { 26 self.max_capacity 27 } 28 29 /// Returns the `time_to_live` of the cache. 30 pub fn time_to_live(&self) -> Option<Duration> { 31 self.time_to_live 32 } 33 34 /// Returns the `time_to_idle` of the cache. 35 pub fn time_to_idle(&self) -> Option<Duration> { 36 self.time_to_idle 37 } 38}