cache static method
A check that writes a key to the cache and reads it back.
store is a store name of AppConfig.cache, default store when null.
Implementation
static HealthCheckFunction cache([String? store]) {
Future<bool> check() async {
// use the result: with `CoreFlags.cacheCopies` store() gives a copy
Cache cache = store == null ? Cache() : Cache().store(store);
String key = 'dox_health_check';
await cache.put(key, 'ok', duration: const Duration(minutes: 1));
return await cache.get(key) == 'ok';
}
return check;
}