getCache method

Future<HttpCacheObj?>? getCache(
  1. String cacheKey
)

获取缓存

Implementation

Future<HttpCacheObj?>? getCache(String cacheKey) async {
  try {
    if (isAppCache()) {
      var map = await _database?.query(
        "HttpCacheObj",
        where: "cacheKey = ?",
        whereArgs: [cacheKey],
      );
      Map<String, dynamic>? cacheMap = map?.firstOrNull;
      if (cacheMap != null) {
        return HttpCacheObj(
          cacheMap["cacheKey"],
          cacheMap["cacheValue"],
          cacheMap["expireTime"],
        );
      }
    }
    return _otherAppCache[cacheKey];
  } catch (e) {
    Log.w("get cache error: ${e.toString()}");
  }
  return null;
}