open-vault/ui/app/lib/memory-storage.js
Hamid Ghaf 27bb03bbc0
adding copyright header (#19555)
* adding copyright header

* fix fmt and a test
2023-03-15 09:00:52 -07:00

26 lines
366 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
const cache = {};
export default {
getItem(key) {
var item = cache[key];
return item && JSON.parse(item);
},
setItem(key, val) {
cache[key] = JSON.stringify(val);
},
removeItem(key) {
delete cache[key];
},
keys() {
return Object.keys(cache);
},
};