findCache method

Future<CacheItem?> findCache(
  1. String key
)

查找缓存

Implementation

Future<CacheItem?> findCache(String key) async {
  final row = await (select(
    cacheItems,
  )..where((c) => c.key.equals(key))).getSingleOrNull();
  if (row == null) return null;
  if (row.expiresAt.isBefore(DateTime.now())) {
    await deleteCache(key);
    return null;
  }
  return row;
}