@@ -11,6 +11,7 @@ export class CacheTag {
1111 this . tag = tags . join ( ":" ) ;
1212 this . forgetTag = `forget:${ this . tag } ` ;
1313 }
14+
1415 async get ( key ?: string ) : Promise < CachedValue > {
1516 return await this . waitForLock ( async ( ) => {
1617 const values = await this . cacheStore . get ( this . tag ) ;
@@ -20,9 +21,11 @@ export class CacheTag {
2021 return values ;
2122 } ) ;
2223 }
24+
2325 async has ( key : string ) : Promise < boolean > {
2426 return ( await this . get ( key ) ) !== undefined ;
2527 }
28+
2629 async put ( key : string , value : CachedValue , seconds ?: number ) {
2730 return await this . waitForLock ( async ( ) => {
2831 const values = ( await this . cacheStore . get ( this . tag ) ) || { } ;
@@ -39,6 +42,7 @@ export class CacheTag {
3942 return true ;
4043 } ) ;
4144 }
45+
4246 async forget ( key ?: string ) {
4347 return await this . waitForLock ( async ( ) => {
4448 if ( key ) {
@@ -55,9 +59,10 @@ export class CacheTag {
5559 return true ;
5660 } ) ;
5761 }
62+
5863 async waitForLock (
5964 callback : ( ) => Promise < CachedValue > ,
6065 ) : Promise < CachedValue > {
61- return await this . cacheStore . lock ( this . tag , callback , 60 ) ;
66+ return await this . cacheStore . lock ( this . tag , callback , 10 ) ;
6267 }
6368}
0 commit comments