2023-03-15 16:00:52 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2022-11-09 23:15:31 +00:00
|
|
|
const cache = {};
|
2018-04-03 14:16:57 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
},
|
|
|
|
};
|