Construct a new cache store object.
Machine-readable name of the store.
Callback that fetches the data to be cached.
Maximum age of the cache in minutes.
Directory name the file lives in.
Name of the JSON file the cached data lives in.
Directory name the file lives in.
Name of the JSON file the cached data lives in.
Callback function that fetches the data to be cached.
Maximum age of the cache in minutes.
Machine-readable name of the store.
Full store file path.
Create the store directory.
Get the data.
If the cache is not expired yet according to the expiration time, it will return the cache. Otherwise it will fetch new data, save it to the store, and return it.
This method uses the following strategy:
Data.
Calculate the actual expiration date, i.e. now + expiration time.
Check if the cache is expired.
Cached data to check. If no parameter is passed, this method will read the cache store using readCache.
true
if the cache is expired. Otherwise false
.
Read the cache, regardless of the expiration date.
Cached data
Write the newly fetched data to the cache store.
Cached data to write.
Generated using TypeDoc
Chowchow's cache store. This is the main class for managing cached data.