cache.js 409 B

1234567891011121314151617181920212223242526
  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. };