mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-05 20:36:26 +02:00
* license: update headers to IBM Corp. * `make proto` * update offset because source file changed Signed-off-by: Ryan Cragun <me@ryan.ec> Co-authored-by: Ryan Cragun <me@ryan.ec>
26 lines
430 B
TypeScript
26 lines
430 B
TypeScript
/**
|
|
* Copyright IBM Corp. 2016, 2025
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
const cache: { [key: string]: string } = {};
|
|
|
|
export default {
|
|
getItem(key: string) {
|
|
const item = cache[key];
|
|
return item && JSON.parse(item);
|
|
},
|
|
|
|
setItem(key: string, val: unknown) {
|
|
cache[key] = JSON.stringify(val);
|
|
},
|
|
|
|
removeItem(key: string) {
|
|
delete cache[key];
|
|
},
|
|
|
|
keys() {
|
|
return Object.keys(cache);
|
|
},
|
|
};
|