const oneSec = 1000 ; const defMaxAge = 5 * oneSec ; internal export class Cache < T = Record < string , any > > { private value : T | null ; private timer ? : NodeJS . Timeout ; /**
     * Delete cached value after maxAge ms.
     */ constructor ( private readonly maxAge = defMaxAge ) { this . value = null ; } get ( ) { return this . value ; } set ( value ) { this . del ( ) ; this . value = value ; this . timer = setTimeout ( ( ) => this . del ( ) , this . maxAge ) ; } del ( ) { if ( this . timer ) { clearTimeout ( this . timer ) ; } this . value = null ; } }