fix(rules-injector): cache directory scan results per session
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
export type RuleScanCache = {
|
||||
get: (key: string) => string[] | undefined;
|
||||
set: (key: string, value: string[]) => void;
|
||||
clear: () => void;
|
||||
};
|
||||
|
||||
export function createRuleScanCache(): RuleScanCache {
|
||||
const cache = new Map<string, string[]>();
|
||||
|
||||
return {
|
||||
get(key: string): string[] | undefined {
|
||||
return cache.get(key);
|
||||
},
|
||||
set(key: string, value: string[]): void {
|
||||
cache.set(key, value);
|
||||
},
|
||||
clear(): void {
|
||||
cache.clear();
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user