2016-12-09 09:32:24 +00:00
|
|
|
var CacheEntry = require('./CacheEntry');
|
|
|
|
|
|
|
|
var BaseCache = function ()
|
|
|
|
{
|
|
|
|
this.entries = new Map();
|
|
|
|
};
|
|
|
|
|
|
|
|
BaseCache.prototype.constructor = BaseCache;
|
|
|
|
|
|
|
|
BaseCache.prototype = {
|
|
|
|
|
|
|
|
add: function (key, data)
|
|
|
|
{
|
2017-01-16 21:55:04 +00:00
|
|
|
this.entries.set(key, data);
|
2016-12-09 09:32:24 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
has: function (key)
|
|
|
|
{
|
2017-01-16 21:55:04 +00:00
|
|
|
return this.entries.has(key);
|
2016-12-09 09:32:24 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
get: function (key)
|
|
|
|
{
|
2017-01-16 21:55:04 +00:00
|
|
|
return this.entries.get(key);
|
2016-12-09 09:32:24 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
remove: function (key)
|
|
|
|
{
|
2017-01-16 21:55:04 +00:00
|
|
|
this.entries.delete(key);
|
2016-12-09 09:32:24 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
destroy: function ()
|
|
|
|
{
|
2017-01-16 21:55:04 +00:00
|
|
|
this.entries.clear();
|
2016-12-09 09:32:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = BaseCache;
|