In-memory cache with high hit rates via LFU eviction for Node and browsers. Supports time-based expiration, automatic loading and metrics.
MIT License
Bot releases are visible (Hide)
Transitory has been rewritten in TypeScript allowing for a safer cache implementation and easier use in other TypeScript projects.
API changes in 2.x:
Cache
can no longer be used with instanceof
, it has been replaced with AbstractCache
get(key)
has been replaced with getIfPresent(key)
for all non-loading cachesRemovalCause
has been renamed to RemovalReason
and now uses strings instead of symbolsnewCache()
instead of directly via the imported objectOther changes:
cleanUp()
is now part of the public API. It can be used toequest clean up of the cache by removing expired entries and old data. In most cases this is not needed. See README for details.instanceof
: if(obj instanceof transitory.Cache)