1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use super::{
config::{Config, EventType},
InMemoryCache,
};
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct InMemoryCacheBuilder(Config);
impl InMemoryCacheBuilder {
pub fn new() -> Self {
Self::default()
}
pub fn build(self) -> InMemoryCache {
InMemoryCache::new_with_config(self.0)
}
pub fn event_types(mut self, event_types: EventType) -> Self {
self.0.event_types = event_types;
self
}
pub fn message_cache_size(mut self, message_cache_size: usize) -> Self {
self.0.message_cache_size = message_cache_size;
self
}
}
#[cfg(test)]
mod tests {
use super::InMemoryCacheBuilder;
use static_assertions::assert_impl_all;
use std::fmt::Debug;
assert_impl_all!(InMemoryCacheBuilder: Clone, Debug, Default, Send, Sync);
}