File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -35,17 +35,23 @@ export class Auth extends BaseAuth {
35
35
}
36
36
37
37
export class WorkersKVStoreSingle extends WorkersKVStore {
38
- private static instance ?: WorkersKVStoreSingle ;
38
+ private static instance ?: Map < string , WorkersKVStoreSingle > ;
39
39
40
40
private constructor ( cacheKey : string , cfKVNamespace : KVNamespace ) {
41
41
super ( cacheKey , cfKVNamespace ) ;
42
42
}
43
43
44
44
static getOrInitialize ( cacheKey : string , cfKVNamespace : KVNamespace ) : WorkersKVStoreSingle {
45
45
if ( ! WorkersKVStoreSingle . instance ) {
46
- WorkersKVStoreSingle . instance = new WorkersKVStoreSingle ( cacheKey , cfKVNamespace ) ;
46
+ WorkersKVStoreSingle . instance = new Map < string , WorkersKVStoreSingle > ( ) ;
47
47
}
48
- return WorkersKVStoreSingle . instance ;
48
+ const instance = WorkersKVStoreSingle . instance . get ( cacheKey ) ;
49
+ if ( instance ) {
50
+ return instance ;
51
+ }
52
+ const newInstance = new WorkersKVStoreSingle ( cacheKey , cfKVNamespace ) ;
53
+ WorkersKVStoreSingle . instance . set ( cacheKey , newInstance ) ;
54
+ return newInstance ;
49
55
}
50
56
}
51
57
You can’t perform that action at this time.
0 commit comments