Infrastructure low complexity mobile
0
Dependencies
0
Dependents
0
Entities
0
Integrations

Description

Drift table definition for the local SQLite statistics cache on the mobile device. Stores serialized StatsSnapshot objects keyed by userId and date range so the dashboard is available offline. Includes a cached_at timestamp for TTL-based eviction.

Feature: Personal Activity Statistics

statistics-cache-schema

Responsibilities

  • Define the statistics_cache Drift table with userId, rangeStart, rangeEnd, payload JSON, and cached_at
  • Provide generated Drift DAOs for insert, query, and delete operations
  • Enforce TTL eviction by exposing a deleteExpiredEntries() method

Interfaces

StatisticsCacheTable (Drift TableInfo)
StatisticsCacheDao.insert(StatisticsCacheCompanion)
StatisticsCacheDao.findByUserAndRange(String userId, DateTime start, DateTime end)
StatisticsCacheDao.deleteByUser(String userId)
StatisticsCacheDao.deleteExpiredEntries(DateTime cutoff)