HttpCache class
Main HTTP cache implementation HTTP caching standard compliant caching for HTTP requests and responses
Constructors
- HttpCache({required CacheConfig config})
Properties
- config → CacheConfig
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → Future< void> - Clears the entire cache
-
clearExpired(
) → Future< void> - Clears expired entries
-
close(
) → Future< void> - Closes the cache and releases resources
-
generateValidationHeaders(
CacheEntry entry, Map< String, String> originalHeaders) → Map<String, String> - Generates validation headers for a cached entry
-
get(
{required String method, required Uri uri, required Map< String, String> requestHeaders, CachePolicy? policy}) → Future<CachedResponse?> - Gets a cached response if available and usable
-
getStats(
) → Future< Map< String, dynamic> > - Gets cache statistics
-
getWithRequest(
HttpCacheRequest request) → Future< CachedResponse?> - Gets a cached response using a request object
-
initialize(
) → Future< void> - Initializes the cache (must be called before use)
-
invalidateOnUnsafeMethod(
{required String method, required Uri uri, required int statusCode, required Map< String, String> requestHeaders, required Map<String, String> responseHeaders}) → Future<void> - Invalidates cache on unsafe methods
-
invalidateWithRequest(
HttpCacheRequest request, HttpCacheResponse response) → Future< void> - Invalidates cache on unsafe methods using request and response objects
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
put(
{required String method, required Uri uri, required int statusCode, required Map< String, String> requestHeaders, required Map<String, String> responseHeaders, required List<int> body, required DateTime requestTime, required DateTime responseTime}) → Future<bool> - Stores a response in the cache
-
putWithRequest(
HttpCacheRequest request, HttpCacheResponse response) → Future< bool> - Stores a response using request and response objects
-
toString(
) → String -
A string representation of this object.
inherited
-
updateFrom304(
{required String method, required Uri uri, required Map< String, String> requestHeaders, required Map<String, String> response304Headers, required DateTime validationRequestTime, required DateTime validationResponseTime}) → Future<CacheEntry?> - Updates a cached entry from a 304 Not Modified response
-
updateFrom304WithRequest(
HttpCacheRequest request, HttpCacheResponse response304) → Future< CacheEntry?> - Updates a cached entry from a 304 response using request and response objects
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited