Clear read cache

This commit is contained in:
Andrew Morris
2024-02-29 10:04:13 +11:00
parent 7368453a2e
commit e249776a10
2 changed files with 7 additions and 1 deletions

View File

@@ -35,6 +35,10 @@ impl<SB: StorageBackend> Storage<SB> {
.transaction_mut(Rc::downgrade(&self.sb), |sb| sb.remove_head(ptr))
}
pub fn clear_read_cache(&mut self) {
self.sb.borrow_mut().get_read_cache().clear()
}
pub fn store_tmp<SE: StorageEntity<SB>>(
&mut self,
value: &SE,

View File

@@ -107,7 +107,6 @@ impl DbActor {
Self {
storage,
apply_fn: inline_valuescript(
// TODO: store in actor
r#"
export default function(req) {
if ("handleRequest" in this) {
@@ -197,6 +196,9 @@ impl Handler<DbRequest> for DbActor {
.set_head(storage_head_ptr(b"state"), &instance)
.unwrap();
// TODO: Consider more cache retention
self.storage.clear_read_cache();
res
}
}