Caching & Retry
PrismNetwork provides two complementary resilience layers: an actor-based response cache with LRU eviction and TTL, and pluggable retry policies for automatic request retries.Response Cache
PrismResponseCache
An actor-isolated LRU cache that stores response data with time-to-live:Basic Cache Usage
Cache Policies
PrismCachePolicy controls how requests interact with the cache layer:
Using Cache Policies
Cache Entry
EachPrismCacheEntry tracks its creation time and TTL:
Cache Entry Properties
Retry Policies
PrismRetryPolicy Protocol
Implement this protocol to define custom retry logic:Protocol Definition
Exponential Backoff
PrismExponentialBackoff increases the delay exponentially with random jitter to prevent thundering herd:
Exponential Backoff
min(baseDelay × 2^attempt + jitter, maxDelay) where jitter is a random value between 0 and 0.5 seconds.
Linear Retry
PrismLinearRetry uses a constant delay between attempts:
Linear Retry
Custom Retry Policy
Implement the protocol for fine-grained control:Custom Policy
Combining Cache + Retry
Use both layers together for resilient networking:Resilient Network Layer
Next Steps
Advanced Features
Request deduplication, offline queues, multipart uploads, and GraphQL.
WebSocket Client
Real-time communication with the WebSocket client.