Skip to content

Commit 7a53b42

Browse files
starknet_patricia_storage: flush explictly to cache
1 parent ea60323 commit 7a53b42

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
@@ -221,6 +221,14 @@ impl<S: Storage> CachedStorage<S> {
221221
pub fn total_writes(&self) -> u128 {
222222
self.writes
223223
}
224+
225+
pub fn flush_to_cache(&mut self, map: DbHashMap) {
226+
let cache =
227+
Arc::get_mut(&mut self.cache).expect("Failed to get mutable reference to cache.");
228+
map.into_iter().for_each(|(key, value)| {
229+
cache.put(key, Some(value));
230+
});
231+
}
224232
}
225233

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

0 commit comments

Comments
 (0)