Saving temporary data in memory, and clear the old data at regular time.
Be inspired by the GC algorithm of JVM and V8. I use two area to store data , the old area and the young area. After initializing the class of
FlashCache with a given interval value, the instance of FlashCache's object will move the young area's data to old area, and then create a new young area. It's suit for saving temporary data in memory to improve you app's performance.
npm install flash-cache
See the api doc.
const FlashCache = ;const cache = ;//The default interval of moving young to old is 1000ms.cache;console;;