how to make it work with arbitrary data store
niloy opened this issue · comments
Niloy Mondal commented
Right now, the cache is in-memory. I am interested in using it in the browser with IndexedDB.
Rasmus commented
Since this little library is merely just a doubly-linked list with some logic for eviction, there's really nothing you can use IMHO. You might want to implement LRU logic on top of indexeddb (or localstorage.)
Niloy Mondal commented
Instead of directly using this._keymap
, if you use functions like putInStore
and getFromStore
, I can extend your class and override those methods to use indexedDB.
Rasmus commented
_keymap is just an optimization for key lookup. The actual data and keys are maintained in a doubly-linked list.