velo-org / velo

A high-performance caching library for Deno. Supports LRU, LFU, ARC, and TinyLFU.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cache Stats improvement

herzogmatthias opened this issue · comments

optionally collect cache stats.

const cache = Velo.builder().stats().build();
const stats = cache.stats();
cache.stats() returns a CacheStatistics object
export interface CacheStatistics {
  hits: number;
  misses: number;
  hitRatio: number;
}

if not enabled the stats should be zero or throw an error at cache.stats()