@bitblit/ratchet-aws
Version:
Common tools for use with AWS browser and node
28 lines • 722 B
JavaScript
export class MemoryStorageProvider {
_cache = new Map();
async readFromCache(cacheKey) {
return this._cache.get(cacheKey);
}
async storeInCache(value) {
let rval = false;
if (value?.cacheKey) {
this._cache.set(value.cacheKey, value);
rval = true;
}
return rval;
}
async removeFromCache(cacheKey) {
if (cacheKey) {
this._cache.delete(cacheKey);
}
}
async clearCache() {
const rval = this._cache.size;
this._cache = new Map();
return rval;
}
async readAll() {
return Array.from(this._cache.values());
}
}
//# sourceMappingURL=memory-storage-provider.js.map