ViaCachePipeline class

A pipeline that caches successful GET responses.

Responses are stored in memory and returned for subsequent requests to the same URL until the duration expires.

Inheritance

Constructors

ViaCachePipeline({required Duration duration, CacheStrategy strategy = CacheStrategy.fullUrl, int maxEntries = 100, bool canCache(ViaBaseResult result)?})

Properties

canCache bool Function(ViaBaseResult result)?
Optional callback to decide if a specific result should be cached.
final
duration Duration
How long each response should remain in the cache.
final
hashCode int
The hash code for this object.
no setterinherited
maxEntries int
Maximum number of items to keep in memory (FIFO).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
strategy CacheStrategy
The strategy used to generate cache keys.
final

Methods

clearCache() → void
Clear all cached responses
clearCacheFor(ViaRequest request) → void
Clear cached response for specific URI
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError(ViaException error) → void
Called when an error occurs during processing.
inherited
onRequest(ViaRequest request) ViaRequest
Called before request is sent. Return modified request or throw SkipRequest to skip execution.
override
onResult(ViaResult result) Future<ViaResult>
Called after buffered response is received.
override
onResultStream(ViaResultStream result) Stream<List<int>>
Called when a streaming response is received. Use this to intercept, log, or transform the stream data chunks.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited