super_cache 1.0.0
super_cache: ^1.0.0 copied to clipboard
A production-grade, mobile-first LRU caching engine for Flutter. Zero external dependencies. Includes TTL, observability, memory pressure awareness, layered orchestration, and Clean Architecture integration.
Changelog #
All notable changes to super_cache are documented here.
Releases follow Semantic Versioning.
1.0.0 — 2024-01-01 #
Stable public release. API is frozen — no breaking changes will be made without a major version bump.
Added #
CacheOrchestrator<K,V>— sequential L1 → L2 → L3 cache with automatic promotion on hit.CacheRepositoryMixin<K,V>— addsfetchWithCacheto any repository class; supportsCacheAside,WriteThrough, andRefreshAheadpolicies with built-in stampede protection.MemoryCachePressureWatcher<K,V>—WidgetsBindingObserverintegration that evicts 20% (moderate) or 50% (critical) of LRU entries on iOS/Android memory pressure events. Exported fromsuper_cache_flutter.dart.CacheDebugOverlay<K,V>— Flutter widget showing live hit-rate, entry count, and estimated bytes. Exported fromsuper_cache_flutter.dart.- Barrel split:
super_cache.dart(pure Dart) andsuper_cache_flutter.dart(Flutter-specific exports). Use the plain barrel in Dart-only code.
Changed #
MemoryCachesliding TTL now correctly resetslastAccessedAton every non-expiredget().- Bytes-based eviction triggers as soon as
estimatedBytes > maxBytes.
0.2.0 #
Added #
- Sliding TTL mode (
TTLMode.sliding). - Bytes-based capacity limit (
maxBytes+SizeEstimator<V>). metricsStream— broadcast stream that emitsCacheMetricson every sweep interval.CacheMetrics.hitRate,missRate,copyWith,toString.CacheOrchestrator,CacheRepositoryMixin,CacheDebugOverlay,MemoryCachePressureWatcher.
0.1.0 #
Initial internal release.
Added #
Cache<K,V>abstract interface withFutureOr<V?>returns (memory and disk implementations share one interface).MemoryCache<K,V>— O(1) LRU usingHashMap+ manual doubly-linked list.- Count-based eviction (
maxEntries). - Absolute TTL with lazy expiration on
get(). - Background sweep timer (configurable interval, cancelled in
dispose()). CacheResult<V>sealed class:CacheHit,CacheStale,CacheMiss.CachePolicysealed class:CacheAside,WriteThrough,RefreshAhead.CacheCodec<V>interface (used by disk and secure layers).CacheMetricssnapshot (hits, misses, evictions, currentEntries, estimatedBytes, hitRate, since).putAll,removeWhere,containsKey,getResult.