diff --git a/src/adapters/cache/ICacheAdapter.js b/src/adapters/cache/ICacheAdapter.js new file mode 100644 index 00000000..e4c49adc --- /dev/null +++ b/src/adapters/cache/ICacheAdapter.js @@ -0,0 +1,9 @@ +export default class ICacheAdapter { + get() {} + + set() {} + + clear() {} + + delete() {} +} diff --git a/src/adapters/cache/MapCache.js b/src/adapters/cache/MapCache.js new file mode 100644 index 00000000..63e57426 --- /dev/null +++ b/src/adapters/cache/MapCache.js @@ -0,0 +1,24 @@ +import ICacheAdapter from "./ICacheAdapter"; + +export default class MapCache extends ICacheAdapter { + constructor() { + super(); + this.store = new Map(); + } + + get(key) { + return this.store.get(key); + } + + set(key, value) { + this.store.set(key, value); + } + + clear() { + this.store.clear(); + } + + delete(key) { + this.store.delete(key); + } +}