Impact Result Cache Service
Component Detail
Service Layer
low complexity
mobile
0
Dependencies
0
Dependents
0
Entities
0
Integrations
Description
Flutter-side service that persists the most recently received ImpactResult to the local Drift database so the Advantage Calculator Screen can display a result when offline. Tracks the timestamp of the cached result and exposes staleness metadata consumed by the UI.
impact-result-cache-service
Responsibilities
- Persist the latest ImpactResult for a user to the local encrypted Drift database
- Return the cached result and its age when the device is offline or the backend is unreachable
- Invalidate cache entry when the user triggers a successful live recalculation
Interfaces
saveResult(userId, result: ImpactResult) → Future<void>
getCachedResult(userId) → CachedImpactResult? (includes lastUpdatedAt)
clearCache(userId) → Future<void>