So, for all these examples the assumed set up is a main.js
file that imports a cache.js
file. All the methods dealing with the cache(s) will be inside the cache.js
file and will return a
Promise
. Here is an example of a function inside the main.js
file that calls a function in cache.js
and receives a Promise in return. The code in main.js
uses a then()
to wait for the
completion of the code in cache.js
.
//main.js