queryx_persistence 0.1.0
queryx_persistence: ^0.1.0 copied to clipboard
Persistent cache adapters for queryx — Hive and sqlite3 implementations of CacheStorage, plus cache hydration on startup and write-through persistence helpers.
Changelog #
0.1.0 #
Initial release.
HiveCacheStorage—CacheStoragebacked by a HiveBox.SqliteCacheStorage—CacheStoragebacked bysqlite3(pure-Dart FFI, no platform channels).InMemoryCacheStorage— non-persistent reference implementation, used in this package's own tests.initializePersistentCache— schema-version check on startup; wipes storage on a version mismatch instead of risking a crash deserializing incompatible data.hydrateQuery<T>— reads + decodes a persisted entry straight into aQueryClient's in-memory cache viasetQueryData; drops (rather than crashes on) a corrupt individual entry.persistedFetcher<T>— wraps any fetcher for write-through persistence; a failing disk write never surfaces as a query failure.- Test suite (plain
dart test): full CRUD + version behavior for all threeCacheStorageimplementations (Hive viahive_test's in-memory setup, sqlite3 viasqlite3.openInMemory()), hydration success/empty/ corrupt-entry paths, version-mismatch wiping, and write-through composed with a realQueryClientquery.
Not included yet #
- Isar adapter — Isar's code-generation step (
isar_generator+build_runner) didn't fit this package's zero-build-step philosophy for a first release. TheCacheStorageinterface is small; an Isar adapter is a welcome contribution followingSqliteCacheStorage's shape.