INNER CODE UNIT · JavaScript
FileCache
thinkjs/thinkjs · packages/think-cache-file/index.js:27
class FileCache {
constructor(config) {
config = helper.extend({}, defaultOptions, config);
this.timeout = config.timeout;
this.cachePath = config.cachePath;
this.pathDepth = config.pathDepth;
this.store = new FileStore(this.cachePath);
assert(this.cachePath && helper.isString(this.cachePath), 'config.cachePath must be set');
// gc interval by 1 hour
this.gcType = `cache-${this.cachePath}`;
gc(this, config.gcInterval);
}
/**
* get file path by the cache key
* @param {String} key [description]
* @return {String} [description]