cacherine
A Dart in-memory cache library with FIFO, LRU, MRU, LFU, TTL expiry, async-safe variants, and monitoring metrics.
2.4.0
3.0K downloads/mo
#4635 most downloaded on pub.dev
yordgenome03/cacherine
What this package is like to depend on
Last release 2 months ago
04 Jun 2026
Release timing varies
gaps range from 3 weeks to 8 months
Nearly every release is documented
notes for 13 of 13 stable releases
Nothing withdrawn
no release was ever pulled
2 years old
13 releases · first in 2025
8 releases in the last 12 months
see the full history below
Release timeline
13 releases · Feb 2025 to Jun 2026Releases
latest 13-
2.4.004 Jun 2026Release notes
Open source →New Features
- Added
putIfAbsent(),update(), andremoveWhere()default APIs to simple, async-safe, and TTL cache interfaces. - Added TTL-aware
putIfAbsent()andupdate()overloads so new or updated entries can receive per-entry TTL overrides through TTL abstractions. - Added
getAll(),setAll(), andremoveAll()bulk operation APIs to simple, async-safe, and TTL cache interfaces. - Added TTL-aware
setAll()overloads so batches can receive a shared per-entry TTL override through TTL abstractions.
Documentation
- Documented conditional mutation helpers and clarified
getOrCompute()same-instance serialization semantics. - Documented bulk operation helpers and their cache policy side effects.
Maintenance
- Added injectable clock support to
CacheMetricsfor deterministic eviction-window and dashboard tests. - Expanded contract coverage for conditional mutation helpers, bulk operations, TTL helper forwarding, and TTL
getOrCompute()concurrent computation behavior.
- Added
-
2.3.004 Jun 2026Release notes
Open source →Documentation
- Expanded the runnable example and README cache-aside snippets to cover both
getOrSet()and TTL-awaregetOrCompute(). - Documented the non-mutating
peek()API across README and cache guides. - Documented occupancy APIs (
size,isEmpty, andisNotEmpty) across README and cache guides. - Documented explicit TTL expiry cleanup with
purgeExpired().
New Features
- Added
peek()to simple, async-safe, monitored, and TTL cache variants so callers can read values without updating cache eviction state. - Added
size,isEmpty, andisNotEmptyto simple, async-safe, monitored, and TTL cache variants so callers can inspect cache occupancy without materializing keys directly. - Added
purgeExpired()toSimpleTTLCache,TTLCache,MonitoredTTLCache, and the TTL cache interfaces so callers can explicitly remove expired TTL entries and inspect how many were removed.
Maintenance
- Updated dependency constraints for
synchronizedandlintsto the newest resolvable versions for the current SDK range. - Added regression coverage for
peek()nullable-value behavior, policy side effects, monitored traffic metrics, and TTL expiry. - Added regression coverage for cache occupancy APIs across standard, simple, monitored, ephemeral, and TTL caches.
- Added regression coverage for explicit TTL expiry cleanup and monitored eviction metrics.
- Expanded the runnable example and README cache-aside snippets to cover both
-
2.2.003 Jun 2026Release notes
Open source →New Features
- SimpleTTLCache: Added a synchronous TTL cache variant with global and per-entry TTL, lazy expiry,
containsKey(), optionalmaxSize, and FIFO capacity eviction. - TTL cache interfaces: Added
SimpleTTLCacheInterfaceandThreadSafeTTLCacheInterfaceso abstract cache references can still expose per-entry TTL overrides. - Cache-aside population: Added
getOrSet()to simple caches andgetOrCompute()to async-safe caches, including TTL per-entry override support through TTL-specific interfaces.
Documentation
- Added runnable package examples covering
SimpleTTLCache,TTLCache, and monitored cache dashboard snapshots. - Documented synchronous TTL usage in the README and TTL guide.
- Documented TTL-specific interfaces for callers that need per-entry expiry through cache abstractions.
- Documented
getKeys()ordering contracts,Disposablelifecycle behavior, and boundedCacheMetricssample storage.
Maintenance
- Added regression coverage for
SimpleTTLCache,TTLCache, andMonitoredTTLCachethrough the new TTL-specific interfaces. - Added regression coverage for cache-aside population,
dispose()idempotency, post-dispose operations, andgetKeys()ordering contracts.
- SimpleTTLCache: Added a synchronous TTL cache variant with global and per-entry TTL, lazy expiry,
-
2.1.003 Jun 2026Release notes
Open source →New Features
- MonitoredTTLCache: Added a monitored TTL cache variant with hit/miss and latency metrics, eviction tracking for expiry/capacity/manual removals, alert support, and the same TTL configuration options as
TTLCache. - containsKey() API: Added
containsKey()to simple, async-safe, monitored, and TTL cache variants so callers can distinguish storednullvalues from missing keys without mutating eviction state. - CacheMetricsSnapshot: Added a typed
CacheMetrics.snapshot(Duration window)API with hit/miss rates, latency percentiles, eviction rate, total requests, and capture time. - Monitored cache constructors: Made
CacheAlertConfigoptional for monitored cache variants by providing a default no-op alert callback and default thresholds.
Performance
- MonitoredLFUCache: Replaced O(n) eviction scans with frequency buckets for constant-time LFU eviction.
- CacheMetrics: Reused a single sorted latency snapshot when computing multiple percentiles for metrics snapshots and dashboards.
- TTLCache: Added a capacity benchmark to quantify expired-entry cleanup and FIFO capacity enforcement costs.
Bug Fixes
- Nullable monitored values: Fixed monitored caches so stored
nullvalues are recorded as hits when the key exists. - TTLCache: Validates
sweepIntervaland per-entry TTL values so zero or negative intervals fail fast. - CacheStatsDashboard: Migrated dashboard snapshots to the typed metrics snapshot source for consistent captured timestamps and metric values.
Documentation
- Clarified async-safe cache contracts and isolate boundaries for
ThreadSafeCacheimplementations. - Documented
containsKey()semantics, nullable value behavior, and TTL expiry behavior. - Documented MonitoredTTLCache usage in the TTL guide and README.
- Clarified monitored cache
toString()output as diagnostic point-in-time state.
Maintenance
- Split CI formatting suggestions into a separate least-privilege Reviewdog job.
- Reduced default workflow token permissions to read-only for CI jobs.
- Added regression coverage for nullable cached values,
containsKey()policy side effects, monitored cache constructors, metrics snapshots, and MonitoredTTLCache expiry paths.
- MonitoredTTLCache: Added a monitored TTL cache variant with hit/miss and latency metrics, eviction tracking for expiry/capacity/manual removals, alert support, and the same TTL configuration options as
-
2.0.116 May 2026Release notes
Open source →Performance
- LFUCache: Replaced O(n) eviction scan with an O(1) frequency-bucket structure. Eviction is now constant-time regardless of cache size.
- LFUCache: Eliminated O(n)
_minFreqrecomputation inremove(). The minimum-frequency pointer is now maintained incrementally.
Bug Fixes
- LFUCache:
toString()now eagerly snapshots_keyMapbefore formatting, preventing a data-race window between the map read and string construction in async contexts.
Documentation
- LFUCache: Class-level note added clarifying that
toString()is not covered by the lock-based thread-safety guarantee; result is a point-in-time snapshot. - LFUCache: Documented unspecified iteration order for
getKeys()andtoString(). - LRUCache / MRUCache: Documented LRU-recency-refresh behavior of
set()on an existing key and the tiebreak semantics.
Maintenance
- Adjusted SDK constraint floor to
>=3.8.0(minimum required bysynchronized ^3.4.0) - Kept
synchronizedat^3.3.1(resolves to 3.4.0+1 in practice, which requires SDK >=3.8.0) - Updated
lintsdev dependency from^5.0.0to^5.1.1to align with the revised SDK baseline - Raised
testdev dependency from^1.25.8to^1.31.0(resolved: 1.31.1) - Removed
dart_code_metrics ^5.7.6(incompatible with theanalyzerversions required by modern test tooling) - CI: Added matrix testing across Dart 3.8.0 and stable; updated GitHub Actions to v4; optimized permissions and tightened job timeouts; added Reviewdog-based format suggestions on PR
- Added
.fvm/and.fvmrcto.gitignore - No public API changes; no breaking changes
-
2.0.015 May 2026Release notes
Open source →feat: release v2.0.0 — CacheStatsDashboard, TTLCache, and Lifecycle Management
Release notes
Open source →New Features
- CacheStatsDashboard: New class that wraps
CacheMetricsto produce typedDashboardSnapshotobjects for terminal-ready metric display. - TTLCache: Added a standalone cache implementation supporting Time-To-Live (TTL) for both global and per-entry expiry.
- Disposable Interface: Introduced a standard
Disposableinterface to handle resource cleanup (timers, controllers) across monitored and TTL caches. - DashboardSnapshot: Immutable value type capturing
hitRate,missRate, latency percentiles (p50,p95,p99),evictionsPerMinute,totalRequests, andcapturedAt. - formatDashboard(): New top-level function that renders a
DashboardSnapshotas a Unicode box-drawing terminal panel with adaptive unit formatting (µs, ms, s).
Breaking Changes
- Interface Implementation: All
Monitored*caches andTTLCachenow implementDisposable. Callers managing these instances should call.dispose()to prevent timer leaks. CacheStatsDashboard.snapshot(Duration window)now throwsArgumentErrorfor zero or negativewindowvalues (previously undefined behaviour propagated fromCacheMetrics.getRecentStats).CacheStatsDashboard.stream(Duration window, Duration interval)now throwsArgumentErrorfor zero or negativeintervalvalues.
- CacheStatsDashboard: New class that wraps
-
1.1.515 May 2026Release notes
Open source →- Fixed spurious eviction in FIFO
set()when updating an existing key. - Fixed unawaited
Futurein LFU/MRU eviction causing silent async errors. - Fixed LFU
set()incorrectly resetting usage count and spuriously evicting when updating an existing key. - Fixed unbounded memory growth in
CacheMetricsby capping stored latency samples. - Fixed miss latency silently discarded in
CacheMetrics/CacheMonitoring. - Fixed incorrect cache descriptions for LRU and MRU.
- Fixed spurious eviction in FIFO
-
1.1.411 Sep 2025 -
1.1.317 Mar 2025Release notes
Open source →- Added documentation for Cache algorithms to the README.
- Updated Dart SDK constraints to require version 3.7.2 or higher in
pubspec.yaml.
-
1.1.215 Feb 2025Release notes
Open source →- Added the following badges to the README:
- Dart CI Badge
- OpenSSF Scorecard Badge
- Codecov Badge
- Documentation Badge
- Added the following badges to the README:
-
1.1.115 Feb 2025Release notes
Open source →- Renamed
docsdirectory todocto comply with pub.dev package layout convention. - Updated dependencies:
- Resolved version constraints for
lints,synchronized, andjspackages.
- Resolved version constraints for
- Refactored project structure for improved consistency across environments.
- No functionality changes; preparation for release and ongoing maintenance.
- Renamed
-
1.0.214 Feb 2025Release notes
Open source →- Updated the
descriptionfield inpubspec.yamlto meetpub.devrequirements. - Expanded the package description to provide a clearer explanation of its functionality and target use cases.
- Updated the
-
1.0.113 Feb 2025Release notes
Open source →- Updated the
descriptionfield inpubspec.yamlto provide a more specific and accurate explanation of the package's functionality.
- Updated the