feat: added cache adapter

This commit is contained in:
Slincnik 2024-12-16 17:41:11 +03:00
parent b26222a947
commit ac461a104d
No known key found for this signature in database
2 changed files with 33 additions and 0 deletions

9
src/adapters/cache/ICacheAdapter.js vendored Normal file
View file

@ -0,0 +1,9 @@
export default class ICacheAdapter {
get() {}
set() {}
clear() {}
delete() {}
}

24
src/adapters/cache/MapCache.js vendored Normal file
View file

@ -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);
}
}