The cache duo uses internally
The cache duo uses internally during builds.
location refers to the destination of the LevelDB database directory.
Reads the all the stored files from the database into memory.
Accepts the updated in-memory
mapping and saves all the files into cache.
Can be used to set/get a single file's data from the cache. If
excluded, it is assumed to be a getter. (otherwise, it will be a setter)
Can be used to set/get a plugin's cache data. If
data is excluded, it
is assumed to be a getter. (otherwise, it will be a setter)
name should be the same as the plugin's name, to make debugging easier.
key can be either a
String or an
Array. Below is a sample plugin
that is using caching.
// hash the source code as well as options to allow this// to work even if the user changes their config!var key = hashsrc hashoptions ;// see if it's already been cachedvar cached = yield cacheplugin'plugin' key; // getif cached return cached;// run the normal transformationvar results = pluginsrc options;// cache the results for next timeyield cacheplugin'plugin' key results; // setreturn results;
Closes the database and wipes it out from the disk.
Currently, this implementation only satisfies the bare-minimum based on duo's current cache implementation. (currently called the "mapping")
Now that there is a robust data-store in place, more features will be added, including: