@@ -42,14 +42,14 @@ export class InMemoryCache implements ICache<Serializable> {
4242 return cacheEntry . expiresAt < Date . now ( ) ;
4343 }
4444
45- #cleanupExpiredEntries( ) : void {
45+ async #cleanupExpiredEntries( ) : Promise < void > {
4646 const expiredKeys : string [ ] = [ ] ;
4747 for ( const [ key , entry ] of this . #cache. entries ( ) ) {
4848 if ( this . #isExpired( entry ) ) {
4949 expiredKeys . push ( key ) ;
5050 }
5151 }
52- expiredKeys . forEach ( ( key ) => this . #cache . delete ( key ) ) ;
52+ await this . mdelete ( expiredKeys ) ;
5353 }
5454
5555 async get ( key : string ) : Promise < Serializable | undefined > {
@@ -97,12 +97,12 @@ export class InMemoryCache implements ICache<Serializable> {
9797 }
9898
9999 async keys ( ) : Promise < string [ ] > {
100- this . #cleanupExpiredEntries( ) ;
100+ await this . #cleanupExpiredEntries( ) ;
101101 return Array . from ( this . #cache. keys ( ) ) ;
102102 }
103103
104104 async size ( ) : Promise < number > {
105- this . #cleanupExpiredEntries( ) ;
105+ await this . #cleanupExpiredEntries( ) ;
106106 return this . #cache. size ;
107107 }
108108
@@ -118,7 +118,7 @@ export class InMemoryCache implements ICache<Serializable> {
118118 async mget (
119119 keys : string [ ] ,
120120 ) : Promise < Record < string , Serializable | undefined > > {
121- this . #cleanupExpiredEntries( ) ;
121+ await this . #cleanupExpiredEntries( ) ;
122122
123123 const result : Record < string , Serializable | undefined > = { } ;
124124 const expiredKeys : string [ ] = [ ] ;
0 commit comments