From 839cf0c6cdf9febbb5836c7ef79b6f9befb27b5f Mon Sep 17 00:00:00 2001 From: Sebastian Kunert Date: Tue, 18 Jul 2023 17:05:40 +0200 Subject: [PATCH] Make trie-cache resettable from backend (#14516) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add ability to reset trie-cache * comment * Update client/db/src/lib.rs Co-authored-by: Bastian Köcher --------- Co-authored-by: Bastian Köcher --- client/db/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/db/src/lib.rs b/client/db/src/lib.rs index 69d8d8cfc3229..21a03582ca744 100644 --- a/client/db/src/lib.rs +++ b/client/db/src/lib.rs @@ -1124,6 +1124,13 @@ impl Backend { Self::from_database(db as Arc<_>, canonicalization_delay, &db_config, needs_init) } + /// Reset the shared trie cache. + pub fn reset_trie_cache(&self) { + if let Some(cache) = &self.shared_trie_cache { + cache.reset(); + } + } + /// Create new memory-backed client backend for tests. #[cfg(any(test, feature = "test-helpers"))] pub fn new_test(blocks_pruning: u32, canonicalization_delay: u64) -> Self {