cache_manager/interfaces/
cache_module_interface.rs1use serde::{Deserialize, Serialize};
4
5use super::CacheManagerOptions;
6
7pub type CacheOptions = CacheManagerOptions;
8
9#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
10pub struct CacheModuleOptions {
11 #[serde(flatten)]
12 pub cache_options: CacheOptions,
13 pub isGlobal: Option<bool>,
14}
15
16impl CacheModuleOptions {
17 pub fn new(cache_options: CacheOptions) -> Self {
18 Self {
19 cache_options,
20 isGlobal: None,
21 }
22 }
23
24 pub fn global(mut self, is_global: bool) -> Self {
25 self.isGlobal = Some(is_global);
26 self
27 }
28}
29
30pub trait CacheOptionsFactory {
31 fn createCacheOptions(&self) -> CacheOptions;
32}
33
34#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
35pub struct CacheModuleAsyncOptions {
36 pub imports: Vec<String>,
37 pub useExisting: Option<String>,
38 pub useClass: Option<String>,
39 pub useFactory: bool,
40 pub inject: Vec<String>,
41 pub extraProviders: Vec<String>,
42 pub isGlobal: Option<bool>,
43 pub options: Option<CacheOptions>,
44}