Add user langs cache

This commit is contained in:
2023-05-22 11:36:53 +02:00
parent f028c00152
commit aee1f80726
7 changed files with 73 additions and 32 deletions

View File

@@ -24,6 +24,7 @@ use self::bot_manager_client::get_bots;
#[derive(Clone)]
pub struct AppState {
pub user_activity_cache: Cache<UserId, bool>,
pub user_langs_cache: Cache<UserId, Vec<String>>,
}
pub struct BotsManager {
@@ -41,7 +42,11 @@ impl BotsManager {
user_activity_cache: Cache::builder()
.time_to_live(Duration::from_secs(5 * 60))
.max_capacity(4096)
.build()
.build(),
user_langs_cache: Cache::builder()
.time_to_live(Duration::from_secs(5 * 60))
.max_capacity(4096)
.build(),
},
next_port: 8000,
bot_port_map: HashMap::new(),