Skip to main content

ttl_cache_service 1.0.1 copy "ttl_cache_service: ^1.0.1" to clipboard
ttl_cache_service: ^1.0.1 copied to clipboard

High-performance in-memory TTL cache with latency-aware eviction (least fetch time evicted first), stampede protection, and func.getTtlCache() extensions.

1.0.1 #

  • Readability Improvement: Renamed TtlEvictionPolicy.lru to TtlEvictionPolicy.leastRecentlyUsed for descriptive, idiomatic Dart naming.
  • Backward Compatibility: Retained @Deprecated('Use leastRecentlyUsed instead') static const lru = leastRecentlyUsed; to guarantee zero breaking changes for existing code.
  • Pub.dev Discoverability: Optimized package topics to high-traffic canonical categories (cache, performance, networking, async, ttl).

1.0.0 #

  • Production-ready 1.0.0 release.
  • Latency-Aware Eviction (TtlEvictionPolicy.leastFetchTime): Prioritizes keeping expensive, high-latency database and network queries in memory when capacity is reached.
  • Function Extensions (func.cache(...)): Intercepts async function tear-offs (0 to 4 arguments) with automatic key generation.
  • Named Parameter Ergonomics: Unified getOrFetch(key, fetcher: () => ...) and deterministic TtlCache.buildKey(...).
  • Stampede / Thundering-Herd Protection: Coalesces concurrent in-flight requests for the same key.
  • Classic LRU Eviction (TtlEvictionPolicy.lru).
  • Flexible TTL: Configurable per-entry and default time-to-live.
  • Hierarchical Invalidation: Exact key, partial prefix, predicate, and function-wide invalidation (invalidateCache, invalidateAllCache).
  • Diagnostics & Metrics: TtlCacheStats tracking hits, misses, hit rate, evictions, and saved latency.
  • Zero Dependencies: 100% pure Dart, compatible with Flutter (all platforms), Dart VM, Web, and Server.

0.1.0 #

  • Initial release.
  • Latency-Aware Eviction (TtlEvictionPolicy.leastFetchTime): Prioritizes keeping expensive, high-latency database and network queries in memory when capacity is reached.
  • Function Extensions (func.getTtlCache(...)): Intercepts async function calls before execution with automatic key generation from function name + parameters.
  • Stampede / Thundering-Herd Protection: Coalesces concurrent in-flight requests for the same key.
  • Classic LRU Eviction (TtlEvictionPolicy.lru).
  • Flexible TTL: Configurable per-entry and default time-to-live.
  • Key, Prefix & Predicate Invalidation: Supports hierarchical key eviction.
  • Diagnostics & Metrics: TtlCacheStats tracking hits, misses, hit rate, evictions, and totalFetchDurationSaved.
  • Zero Dependencies: 100% pure Dart, compatible with Flutter (all platforms), Dart VM, Web, and Server.
1
likes
160
points
179
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

High-performance in-memory TTL cache with latency-aware eviction (least fetch time evicted first), stampede protection, and func.getTtlCache() extensions.

Repository (GitHub)
View/report issues

Topics

#cache #performance #networking #async #ttl

License

MIT (license)

More

Packages that depend on ttl_cache_service