wasmerio / wasmer

🚀 The leading Wasm Runtime supporting WASIX, WASI and Emscripten
https://wasmer.io
MIT License
18.29k stars 776 forks source link

Introduce a general caching abstraction to wasix #4003

Closed Michael-F-Bryan closed 1 week ago

Michael-F-Bryan commented 1 year ago

Motivation

There are many places across the Wasmer CLI and WASIX where we want to use caching to avoid unnecessary work. At the moment, each of these places is hand-rolling its own caching solution.

Off the top of my head, I can think of the following:

These caching solutions all tend to have the same properties or requirements:

Proposed solution

I was thinking of creating a concrete type with an API similar to a HashMap<CollectionName, HashMap<Key, Value>>, except it'll pass out instances of shared_buffer::OwnedBuffer and automatically manage the synchronisation of on-disk and in-memory caches.

This would probably hook into Wasmer Edge's caching facilities, too.

Additional context

This originally came up when I was working on #3983. Having one or two places where we do caching is fine, but I noticed I was doing the same in-memory/on-disk dance in several places and all of it is essentially untested.

stale[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 week ago

Feel free to reopen the issue if it has been closed by mistake.