@agnostack/requestd
Version:
Please contact agnoStack via info@agnostack.com for any questions
29 lines • 906 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const AbstractStorage_1 = __importDefault(require("./AbstractStorage"));
class StorageInMemory extends AbstractStorage_1.default {
constructor(config) {
super(config);
this.defaultGet = config['defaultGet'] || '{}';
this.storage = {};
}
// TODO: handle expires in setItem
setItem(key, value) {
this.storage[key] = value;
}
// TODO: handle expired in getItem
getItem(key) {
return (this.storage[key] || this.defaultGet);
}
removeItem(key) {
delete this.storage[key];
}
static isSupported() {
return true;
}
}
exports.default = StorageInMemory;
//# sourceMappingURL=StorageInMemory.js.map