Overview
asyncAction supports transparent result caching (LRU with optional TTL) and automatic periodic re-fetching. Both features are opt-in via the options object — set cacheLimit / cacheDuration for caching, and pollInterval before calling startPolling().
Use .cache(...args) to invoke with memoization (skips the async function on a cache hit). Use startPolling(...args) / stopPolling() for live dashboards and other “keep fresh” UIs. For advanced composition outside asyncAction, see createCacheManager / createPollingManager.
Built-in vs standalone factories
|
Approach
|
When to use
|
Notes
|
|---|---|---|
asyncAction options + methods
| Common case |
cacheLimit / cacheDuration / pollInterval plus .cache(), .startPolling(), etc.
|
createCacheManager / createPollingManager
| Advanced |
Compose a custom async primitive outside of asyncAction. Most apps never need these directly.
|
asyncAction.cache() and startPolling()
cache(1) skips the network on a hit — loadedAt stays put. A plain call(1) always fetches. startPolling(1) / stopPolling() use pollInterval. subscribe() logs each settle.