rive_cache_inmemory/
builder.rs1use crate::{Config, InMemoryCache};
2
3#[derive(Debug, Default)]
7#[must_use]
8pub struct InMemoryCacheBuilder(Config);
9
10impl InMemoryCacheBuilder {
11 pub const fn new() -> Self {
13 Self(Config::new())
14 }
15
16 pub fn cache_users(mut self, value: bool) -> Self {
18 self.0.cache_users = value;
19 self
20 }
21
22 pub fn cache_servers(mut self, value: bool) -> Self {
24 self.0.cache_servers = value;
25 self
26 }
27
28 pub fn cache_channels(mut self, value: bool) -> Self {
30 self.0.cache_channels = value;
31 self
32 }
33
34 pub fn cache_messages(mut self, value: bool) -> Self {
36 self.0.cache_messages = value;
37 self
38 }
39
40 pub fn cache_emojis(mut self, value: bool) -> Self {
42 self.0.cache_emojis = value;
43 self
44 }
45
46 pub fn cache_members(mut self, value: bool) -> Self {
48 self.0.cache_members = value;
49 self
50 }
51
52 pub fn build(self) -> InMemoryCache {
54 InMemoryCache::new_with_config(self.0)
55 }
56}