export abstract class AbstractCacheService < V > { protected cache = new Map < string , Promise < V > > ( ) ; public async load ( key ) { const cacheHit = this . cache . get ( key ) ; if ( await cacheHit ) { return cacheHit ; } else { const cacheMiss = this . getValue ( key ) ; this . cache . set ( key , cacheMiss ) ; return cacheMiss ; } } protected abstract getValue ( key ) ; }