mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 11:27:47 +00:00
invalidate cache
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import RE2 from "re2";
|
||||
|
||||
import { Lock } from "@app/lib/red-lock";
|
||||
|
||||
import { TKeyStoreFactory } from "./keystore";
|
||||
@@ -19,6 +21,17 @@ export const inMemoryKeyStore = (): TKeyStoreFactory => {
|
||||
delete store[key];
|
||||
return 1;
|
||||
},
|
||||
deleteItems: async (pattern) => {
|
||||
const regex = new RE2(pattern.replace(/\*/g, ".*"));
|
||||
let deletedCount = 0;
|
||||
for (const key of Object.keys(store)) {
|
||||
if (regex.test(key)) {
|
||||
delete store[key];
|
||||
deletedCount += 1;
|
||||
}
|
||||
}
|
||||
return deletedCount;
|
||||
},
|
||||
getItem: async (key) => {
|
||||
const value = store[key];
|
||||
if (typeof value === "string") {
|
||||
|
||||
Reference in New Issue
Block a user