Releases: ori88c/fifo-ttl-cache
Releases · ori88c/fifo-ttl-cache
Added the `has` method, enhanced README and documentation
Key Features:
- Added the
has
method: Determines whether the cache contains a valid, non-expired entry for the specified key. This method is particularly useful when the cache is employed as a Set-like structure, where the presence of a key is significant but the associated value is secondary or unnecessary. - README enhancements: Added an additional example highlighting scenarios where a FIFO cache is preferable to an LRU cache. Documented the newly added
has
method, and updated terminology from "cached records" to "cached entries". - Documentation enhancements: Improved clarity by addressing subtle nuances and refining explanations.
First Release
Key Features ✨
- FIFO Cache: Automatically evicts the oldest record (based on insertion time) when the cache reaches its capacity and a new record with a non-existing key is added, irrespective of the record’s popularity.
- Fixed TTL: Ensures all cached records share the same Time-to-Live (TTL) duration, allowing for automatic eviction of stale entries.
- Efficiency ⚙️: JavaScript's
Map
maintains the insertion order of keys, offering a reliable and often overlooked guarantee for iteration. This guarantee is leveraged inFIFOCache
to eliminate the need for manually managing insertion order for eviction purposes. - Comprehensive Documentation 📚: The class is thoroughly documented, enabling IDEs to provide helpful tooltips that enhance the coding experience.
- Tests 🧪: Fully covered by comprehensive unit tests.
- TypeScript support.
- No external runtime dependencies: Only development dependencies are used.
- ES2020 Compatibility: The
tsconfig
target is set to ES2020, ensuring compatibility with ES2020 environments.