Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@donotjs/donot-cache

donotjs24MITdeprecated1.0.2

This package is no longer actively maintained.

Base abstract class for cache plugins - used for developing cache plugins for donot.

readme

donot-cache

This only contains an abstract class that all cache plugins inherit from. It cannot be used as a cache directly with donot.

Implementing a cache plugin

Implement your cache plugins as the example below.

const Cache = require('donor-cache');

class MyCache extends Cache {
    construct() {
        // Do your constructor work.
    }
    // Gets a cached file
    get(filename) {
        return new Promise((resolved, rejected) => {
            // Get file content from filename and call `resolved` with its data
            // or `rejected` with an error.
        });
    }
    // Caches a file.
    set(filename, data) {
        return new Promise((resolved, rejected) => {
            // Save data to the cache.
        });
    }
    // Invalidates a file (optional).
    invalidate(filename) {
        return new Promise((resolved, rejected) => {
            // Invalidate cache for filename.
        });
    }
}

module.exports = exports = MyCache;

License

MIT