pub struct CachePayload {
pub jwks: Arc<JwkSet>,
pub policy: CachePolicy,
pub etag: Option<String>,
pub last_modified: Option<DateTime<Utc>>,
pub last_refresh_at: DateTime<Utc>,
pub expires_at: Instant,
pub next_refresh_at: Instant,
pub stale_deadline: Option<Instant>,
pub retry_backoff: Option<Duration>,
pub error_count: u32,
}Expand description
Metadata captured for a cached JWKS payload.
Fields§
§jwks: Arc<JwkSet>JWKS document retained for the provider.
policy: CachePolicyHTTP cache policy derived from the last response.
etag: Option<String>Strong or weak validator supplied by the origin.
last_modified: Option<DateTime<Utc>>Last-Modified timestamp advertised by the origin.
last_refresh_at: DateTime<Utc>UTC timestamp when the payload was most recently refreshed.
expires_at: InstantMonotonic deadline after which the payload is considered expired.
next_refresh_at: InstantMonotonic schedule for the next proactive refresh.
On refresh failures this is also repurposed as the cooldown deadline by
adding the computed retry backoff to the current Instant.
stale_deadline: Option<Instant>Optional window permitting stale serving past expiry.
retry_backoff: Option<Duration>Exponential backoff duration before retrying a failed refresh.
This stores the most recent backoff duration; the cache manager combines
it with next_refresh_at to produce the absolute retry instant.
error_count: u32Count of consecutive refresh errors.
Implementations§
Source§impl CachePayload
impl CachePayload
Sourcepub fn is_expired(&self, now: Instant) -> bool
pub fn is_expired(&self, now: Instant) -> bool
Whether the payload has exceeded its freshness window.
Sourcepub fn can_serve_stale(&self, now: Instant) -> bool
pub fn can_serve_stale(&self, now: Instant) -> bool
Whether stale serving is still permitted at the given time.
Sourcepub fn bump_error(&mut self, backoff: Option<Duration>)
pub fn bump_error(&mut self, backoff: Option<Duration>)
Update retry bookkeeping after a failed refresh.
Sourcepub fn reset_failures(&mut self)
pub fn reset_failures(&mut self)
Reset failure bookkeeping after a successful refresh.
Trait Implementations§
Source§impl Clone for CachePayload
impl Clone for CachePayload
Source§fn clone(&self) -> CachePayload
fn clone(&self) -> CachePayload
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more