move shortstatekey_cache to service

This commit is contained in:
Charles Hall 2024-10-08 13:38:12 -07:00
parent 190b788683
commit d3b62e598d
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
4 changed files with 35 additions and 35 deletions

View file

@ -7,11 +7,8 @@ use std::{
sync::{Arc, Mutex, RwLock},
};
use lru_cache::LruCache;
use ruma::{
events::{
push_rules::PushRulesEvent, GlobalAccountDataEventType, StateEventType,
},
events::{push_rules::PushRulesEvent, GlobalAccountDataEventType},
push::Ruleset,
EventId, OwnedRoomId, OwnedUserId, RoomId, UserId,
};
@ -236,8 +233,6 @@ pub(crate) struct KeyValueDatabase {
pub(super) senderkey_pusher: Arc<dyn KvTree>,
// Uncategorized trees
pub(super) shortstatekey_cache:
Mutex<LruCache<ShortStateKey, (StateEventType, String)>>,
pub(super) our_real_users_cache:
RwLock<HashMap<OwnedRoomId, Arc<HashSet<OwnedUserId>>>>,
pub(super) appservice_in_room_cache:
@ -461,14 +456,6 @@ impl KeyValueDatabase {
global: builder.open_tree("global")?,
server_signingkeys: builder.open_tree("server_signingkeys")?,
#[allow(
clippy::as_conversions,
clippy::cast_sign_loss,
clippy::cast_possible_truncation
)]
shortstatekey_cache: Mutex::new(LruCache::new(
(100_000.0 * config.cache_capacity_modifier) as usize,
)),
our_real_users_cache: RwLock::new(HashMap::new()),
appservice_in_room_cache: RwLock::new(HashMap::new()),
lasttimelinecount_cache: Mutex::new(HashMap::new()),