Skip to content

Commit 464262a

Browse files
starknet_patricia_storage: flush explictly to cache
1 parent 35b357d commit 464262a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/starknet_patricia_storage/src/map_storage.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,14 @@ impl<S: Storage> CachedStorage<S> {
219219
pub fn total_writes(&self) -> u128 {
220220
self.writes
221221
}
222+
223+
pub fn flush_to_cache(&mut self, map: DbHashMap) {
224+
let cache =
225+
Arc::get_mut(&mut self.cache).expect("Failed to get mutable reference to cache.");
226+
map.into_iter().for_each(|(key, value)| {
227+
cache.put(key, Some(value));
228+
});
229+
}
222230
}
223231

224232
impl<S: Storage> Storage for CachedStorage<S> {

0 commit comments

Comments
 (0)