getCachedResponse method

ProxyResponse? getCachedResponse(
  1. ProxyRequest request
)

Returns a cached response for request if a non-expired entry exists.

Implementation

ProxyResponse? getCachedResponse(ProxyRequest request) {
  final key = request.cacheKey;
  final entry = _memoryCache[key];
  if (entry != null && !entry.isExpired) {
    return entry.response;
  }
  if (entry != null && entry.isExpired) {
    _memoryCache.remove(key);
  }
  return null;
}