您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

cache.js 409B

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