From aa559f33fe8e214c0e598be90b8018d3caa70438 Mon Sep 17 00:00:00 2001 From: ANIR1604 Date: Wed, 11 Dec 2024 23:46:13 +0530 Subject: [PATCH] Using Cached Libary to store the data in a cache --- Cargo.toml | 1 + crates/matrix-sdk-indexeddb/src/crypto_store/mod.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 79ae1c835cc..307ed5a7b72 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ rust-version = "1.82" [workspace.dependencies] anyhow = "1.0.93" +cached = "0.36.0" aquamarine = "0.6.0" assert-json-diff = "2.0.2" assert_matches = "1.5.0" diff --git a/crates/matrix-sdk-indexeddb/src/crypto_store/mod.rs b/crates/matrix-sdk-indexeddb/src/crypto_store/mod.rs index 5f4c05532c6..45a4cdfa738 100644 --- a/crates/matrix-sdk-indexeddb/src/crypto_store/mod.rs +++ b/crates/matrix-sdk-indexeddb/src/crypto_store/mod.rs @@ -46,7 +46,7 @@ use tokio::sync::Mutex; use tracing::{debug, warn}; use wasm_bindgen::JsValue; use web_sys::IdbKeyRange; - +use cached::proc_macro::cached; use self::indexeddb_serializer::MaybeEncrypted; use crate::crypto_store::{ indexeddb_serializer::IndexeddbSerializer, migrations::open_and_upgrade_db, @@ -1313,7 +1313,7 @@ impl_crypto_store! { Ok(None) } } - + #[cached(size = 100)] async fn get_room_settings(&self, room_id: &RoomId) -> Result> { let key = self.serializer.encode_key(keys::ROOM_SETTINGS, room_id); self