This package has been deprecated

Author message:

This package is no longer actively maintained.

@donotjs/donot-cache

1.0.2 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @donotjs/donot-cache

Weekly Downloads

3

Version

1.0.2

License

MIT

Last publish

Collaborators

  • trenskow_deprecated