Closed Zyles closed 3 years ago
The getCachedValue
and setCachedValue
methods in cachios
are synchronous and do not currently support async/await or Promises. Changing this would need to be done around here: https://github.com/AlbinoDrought/cachios/blob/master/src/cachios.js#L55
Gotcha... I changed everything to async and it seems to work.
So I assume you will not add that option to this library?
I'll try and check it out on the weekend. If added, I'll need to use Promises instead of async/await due to the current project setup - Cachios supports both Node and browser SPAs but doesn't use a bundler or build process.
I previously stripped the bundler from Cachios around October 2018 in #43. I try to keep the dependencies up to date and wasn't a fan of these frequent updates:
(as a side effect, this package can be published with just an npm publish
and the code in this repo matches the code in the package repository 1:1)
I'll post here if implemented. I don't think it will be a breaking change. In the meantime, forking Cachios or just copying the repo to your project and modifying it should work :+1:
:+1: Released as v3.0.0 and added as an example to the repo: https://github.com/AlbinoDrought/cachios/tree/master/examples/persistent-cache-sqlite-keyv
So I had to drop LRU cache because the saved JSON blob got corrupted @ 14000 items...
And decided to try keyv instead with SQLite3 adapter. Which seems like a stronger option with potential real database support. It seems to support get/set like cachios expects but it does not seem to be as plug as play as I thought.
What am I missing here?
Output:
SQLite DB also remains empty so it is obviously not writing there.
Do I need to write custom readCache and writeCache functions for this?
Thanks.