-
Notifications
You must be signed in to change notification settings - Fork 194
Description
Hi!
We are planning to use keyv in metro as a multi-layered cache system. The goal is to let people mix and match different cache layers, by using the Map compatible interface (something we wanted even before finding keyv!).
In order to be layered, we need to be able to broadcast key/value combinations from one layer to the rest (essentially, a successful get in one layer has to be set in all the rest of the layers). However, keyv only supports one single adapter per instance.
While the desired approach can be done either as an adapter that proxies to multiple stores, or as a layer built on top of many keyv instances, I was curious to know if you would like to have such behavior built inside keyv. The current API would not change, but it would allow to pass multiple stores (my idea is to add stores, and keep store as backward-compatible, which would just re-wrap as stores = [store]). Stores would then sequentially be called until we find a positive result.
I'd also like to add a @keyv/memcached, as well as a @keyv/map (which essentially would be module.exports = Map, but it would let combine as well the memory interface by default). For all of that maybe it'd make sense to have a GH keyv organization itself (just suggesting).
We'd like also add Flow typing to it (I've seen #22 for TS support), so I guess that one would be OK as well :)
Let me know what you think! 🙂