pub struct CacheManager { /* private fields */ }Expand description
Coordinates fetching, caching, and background refresh for a registration.
Instances are scoped per tenant/provider pair; the single-flight guard only serialises refresh work for that specific provider.
Implementations§
Source§impl CacheManager
impl CacheManager
Sourcepub fn new(registration: IdentityProviderRegistration) -> Result<Self>
pub fn new(registration: IdentityProviderRegistration) -> Result<Self>
Build a new cache manager with the default reqwest client.
Sourcepub fn with_client(
registration: IdentityProviderRegistration,
client: Client,
) -> Self
pub fn with_client( registration: IdentityProviderRegistration, client: Client, ) -> Self
Build a cache manager using the supplied HTTP client (primarily for tests).
Sourcepub fn metrics(&self) -> Arc<ProviderMetrics>
pub fn metrics(&self) -> Arc<ProviderMetrics>
Access the per-provider metrics accumulator.
Sourcepub async fn snapshot(&self) -> CacheSnapshot
pub async fn snapshot(&self) -> CacheSnapshot
Capture the current cache state for status reporting.
Sourcepub async fn persistent_snapshot(&self) -> Result<Option<PersistentSnapshot>>
pub async fn persistent_snapshot(&self) -> Result<Option<PersistentSnapshot>>
Build a persistence payload capturing the current cache contents.
Sourcepub async fn restore_snapshot(&self, snapshot: PersistentSnapshot) -> Result<()>
pub async fn restore_snapshot(&self, snapshot: PersistentSnapshot) -> Result<()>
Restore cache state from a previously persisted snapshot.
Sourcepub async fn resolve(&self, kid: Option<&str>) -> Result<Arc<JwkSet>>
pub async fn resolve(&self, kid: Option<&str>) -> Result<Arc<JwkSet>>
Resolve JWKS for the registration, fetching upstream when necessary.
Sourcepub async fn trigger_refresh(&self) -> Result<()>
pub async fn trigger_refresh(&self) -> Result<()>
Trigger a manual refresh asynchronously; used by the control plane.
Trait Implementations§
Source§impl Clone for CacheManager
impl Clone for CacheManager
Source§fn clone(&self) -> CacheManager
fn clone(&self) -> CacheManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CacheManager
impl !RefUnwindSafe for CacheManager
impl Send for CacheManager
impl Sync for CacheManager
impl Unpin for CacheManager
impl !UnwindSafe for CacheManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more