pub struct CacheEntry { /* private fields */ }Expand description
Represents a cached JWKS entry for a tenant/provider pair.
Implementations§
Source§impl CacheEntry
impl CacheEntry
Sourcepub fn new(
tenant_id: impl Into<Arc<str>>,
provider_id: impl Into<Arc<str>>,
) -> Self
pub fn new( tenant_id: impl Into<Arc<str>>, provider_id: impl Into<Arc<str>>, ) -> Self
Create a new empty cache entry.
Sourcepub fn provider_id(&self) -> &str
pub fn provider_id(&self) -> &str
Provider identifier for this cache entry.
Sourcepub fn state(&self) -> &CacheState
pub fn state(&self) -> &CacheState
Inspect the current cache state.
Sourcepub fn begin_load(&mut self) -> bool
pub fn begin_load(&mut self) -> bool
Attempt to begin an initial load; returns false when already loading or ready.
Sourcepub fn load_success(&mut self, payload: CachePayload)
pub fn load_success(&mut self, payload: CachePayload)
Record a successful load or refresh, updating state to Ready.
Sourcepub fn begin_refresh(&mut self, now: Instant) -> bool
pub fn begin_refresh(&mut self, now: Instant) -> bool
Attempt to transition into refreshing state when scheduled refresh is due.
Sourcepub fn refresh_success(&mut self, payload: CachePayload)
pub fn refresh_success(&mut self, payload: CachePayload)
Record a successful refresh.
Sourcepub fn refresh_failure(&mut self, now: Instant, next_backoff: Option<Duration>)
pub fn refresh_failure(&mut self, now: Instant, next_backoff: Option<Duration>)
Record a refresh failure and decide whether stale data can remain active.
When a backoff is provided the next refresh instant is shifted forward by that duration, effectively treating it as a cooldown on top of the previously scheduled refresh window.
Sourcepub fn invalidate(&mut self)
pub fn invalidate(&mut self)
Invalidate the cached payload, returning to Empty state.
Sourcepub fn snapshot(&self) -> Option<CachePayload>
pub fn snapshot(&self) -> Option<CachePayload>
Retrieve a clone of the cached payload if present.
Trait Implementations§
Source§impl Clone for CacheEntry
impl Clone for CacheEntry
Source§fn clone(&self) -> CacheEntry
fn clone(&self) -> CacheEntry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more