All files / src/InMemoryCache NoCache.ts

57.14% Statements 4/7
100% Branches 0/0
25% Functions 2/8
57.14% Lines 4/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32  48x     48x   43x       14x                                          
/* eslint-disable @typescript-eslint/no-empty-function */
import { AsyncAction, InMemoryCache, Key } from './InMemoryCache';
import NodeCache from 'node-cache';
 
export class NoCache extends InMemoryCache {
  constructor() {
    super(0, null as unknown as NodeCache);
  }
 
  public get<T>(_key: Key, asyncAction: AsyncAction<T>, _ttl?: number): Promise<T> {
    return asyncAction();
  }
 
  public getVal<T>() {
    return undefined as T;
  }
 
  public set() {
    return false;
  }
 
  public invalidate() {}
 
  public keys(): string[] {
    return [];
  }
 
  public shutdown() {}
 
  public clear() {}
}