syncache_workmanager 0.1.0
syncache_workmanager: ^0.1.0 copied to clipboard
Background flush for Syncache outbox mutations. Wires workmanager's periodic and one-off background tasks to the Syncache mutation outbox so offline writes sync even when the app process has been killed.
Changelog #
0.1.0 #
- Initial release.
SyncacheBackgroundFlusher: flushes Syncache outbox mutations inside a workmanager background task — recovers pending records (recoverPendingMutations), sends them (processPendingMutations), and optionally sweeps expired entries (cleanup), within a wall-clock time budget suited to OS background-execution limits (≈30s on iOS, a few minutes on Android).SyncacheBackgroundCacheRegistration: wires one typed cache into the flusher via injected callbacks (createCache,resolveRecord) so the background isolate rebuilds fresh caches over the app's durable store and outbox.SyncacheFlushReport: per-task counts (recovered, remaining, swept), a budget-exhaustion flag, and duration.runSyncacheTask+isSyncacheTask+ the canonicalsyncacheFlushTaskName/syncacheCleanupTaskNameconstants for wiring a workmanagercallbackDispatcher, withonReport/onErrorhooks for background logging.registerSyncachePeriodicFlush/registerSyncacheOneOffFlushregistration helpers defaulting to a network-connected constraint.- Unsent mutations always stay in the outbox: a background pass that runs out of time or network never loses work.