You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
409 B

4 years ago
  1. 'use strict';
  2. var Cache = module.exports = function Cache() {
  3. this._cache = {};
  4. };
  5. Cache.prototype.put = function Cache_put(key, value) {
  6. this._cache[key] = value;
  7. };
  8. Cache.prototype.get = function Cache_get(key) {
  9. return this._cache[key];
  10. };
  11. Cache.prototype.del = function Cache_del(key) {
  12. delete this._cache[key];
  13. };
  14. Cache.prototype.clear = function Cache_clear() {
  15. this._cache = {};
  16. };