pub struct AuthCache { /* private fields */ }Expand description
Visible-collections cache. Thread-safe; cheaply cloneable through
an enclosing Arc. Construction uses Default::default() so the
cache can sit on AuthStore without extra plumbing.
Implementations§
Source§impl AuthCache
impl AuthCache
pub fn new(ttl: Duration) -> Self
Sourcepub fn get(&self, key: &ScopeKey) -> Option<HashSet<String>>
pub fn get(&self, key: &ScopeKey) -> Option<HashSet<String>>
Look up the cached visible-collections set for (tenant, principal, role).
Returns None on miss or when the entry has expired (the
expired entry stays in place — the next insert overwrites it).
Sourcepub fn insert(&self, key: ScopeKey, collections: HashSet<String>)
pub fn insert(&self, key: ScopeKey, collections: HashSet<String>)
Bookkeeping helper called by the runtime when it has to rebuild
because get returned None. Counts the miss and inserts the
freshly-computed set so the next caller hits the cache.
Sourcepub fn invalidate_all(&self)
pub fn invalidate_all(&self)
Invalidate every entry — used after global IAM events
(CREATE/DROP POLICY, DROP COLLECTION). Increments the
invalidations counter once regardless of map size.
Sourcepub fn invalidate_tenant(&self, tenant: Option<&str>)
pub fn invalidate_tenant(&self, tenant: Option<&str>)
Invalidate every entry whose tenant matches tenant. Used by
GRANT/REVOKE which know the affected tenant from the principal.
pub fn stats(&self) -> AuthCacheStats
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AuthCache
impl RefUnwindSafe for AuthCache
impl Send for AuthCache
impl Sync for AuthCache
impl Unpin for AuthCache
impl UnsafeUnpin for AuthCache
impl UnwindSafe for AuthCache
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request