ajv/lib/cache.js

27 lines
409 B
JavaScript
Raw Permalink Normal View History

'use strict';
var Cache = module.exports = function Cache() {
2016-02-02 21:55:02 +03:00
this._cache = {};
2015-08-11 21:06:32 +03:00
};
Cache.prototype.put = function Cache_put(key, value) {
2016-02-02 21:55:02 +03:00
this._cache[key] = value;
};
Cache.prototype.get = function Cache_get(key) {
2016-02-02 21:55:02 +03:00
return this._cache[key];
};
Cache.prototype.del = function Cache_del(key) {
2016-02-02 21:55:02 +03:00
delete this._cache[key];
2015-08-20 00:54:05 +03:00
};
Cache.prototype.clear = function Cache_clear() {
this._cache = {};
};