hope_cache 0.1.4 copy "hope_cache: ^0.1.4" to clipboard
hope_cache: ^0.1.4 copied to clipboard

Simple and fast caching for Dart/Flutter with TTL support, multiple eviction strategies, and pluggable storage.

0.1.2 #

  • Initial release
  • TTL support (default + per-key)
  • Eviction policies: LRU, LFU, FIFO
  • Map keys (React Query style)
  • Batch operations (setMany, getMany)
  • Pattern invalidation
  • Pluggable storage interface
  • In-memory storage implementation

0.1.3 #

Hope Query — New #

  • HopeBuilder — reactive widget for data fetching, no boilerplate
  • HopeController — internal query engine with full lifecycle management
  • HopeClient — singleton registry, deduplicates controllers by key
  • HopeMutationController — handles write operations with callbacks
  • HopeState — immutable state snapshot with typed flags
  • HopeOptions — query configuration

Query Features #

  • Automatic caching with staleTime — serve instantly, refresh in background
  • Retry with configurable count and delay
  • Infinite scroll — getNextPageParam, fetchMore, hasMore, pages
  • refetchInterval — automatic background polling
  • refetchOnResume — refetch when app comes to foreground, respects staleTime
  • enabled — conditional fetching for dependent queries
  • Reference counting — controllers disposed only when no widgets are listening
  • prefetch — warm cache before user navigates to a screen
  • invalidate — clears cache and forces fresh fetch on all listeners
  • invalidateAll — invalidate every active query at once
  • invalidatePrefix — invalidate a group of related queries
  • setData — manually update controller state for optimistic updates
  • reset — reset mutation state back to idle

Cache Integration #

  • staleTime works alongside cache TTL — two independent freshness controls
  • Timestamp companion key (__ts__) tracks when data was last fetched
  • Invalidation guarantees subsequent controllers always refetch fresh data

0.1.4 #

MIT LICENSE #

1
likes
0
points
67
downloads

Publisher

verified publishersupgrow.com

Weekly Downloads

Simple and fast caching for Dart/Flutter with TTL support, multiple eviction strategies, and pluggable storage.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on hope_cache