pub struct CachingUserDetailsService<S>where
S: UserDetailsService,{ /* private fields */ }Expand description
Implementations§
Source§impl<S> CachingUserDetailsService<S>where
S: UserDetailsService,
impl<S> CachingUserDetailsService<S>where
S: UserDetailsService,
Sourcepub fn new(inner: S) -> CachingUserDetailsService<S>
pub fn new(inner: S) -> CachingUserDetailsService<S>
Create a new caching service with default TTL (5 minutes).
Sourcepub fn ttl(self, ttl: Duration) -> CachingUserDetailsService<S>
pub fn ttl(self, ttl: Duration) -> CachingUserDetailsService<S>
Set the cache TTL (time-to-live).
Sourcepub async fn clear_cache(&self)
pub async fn clear_cache(&self)
Clear the cache.
Sourcepub async fn invalidate(&self, username: &str)
pub async fn invalidate(&self, username: &str)
Invalidate a specific user from cache.
Trait Implementations§
Source§impl<S> UserDetailsService for CachingUserDetailsService<S>
impl<S> UserDetailsService for CachingUserDetailsService<S>
Source§fn load_user_by_username<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<User>, UserDetailsError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
CachingUserDetailsService<S>: 'async_trait,
fn load_user_by_username<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<User>, UserDetailsError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
CachingUserDetailsService<S>: 'async_trait,
Load user by username. Read more
Auto Trait Implementations§
impl<S> Freeze for CachingUserDetailsService<S>where
S: Freeze,
impl<S> !RefUnwindSafe for CachingUserDetailsService<S>
impl<S> Send for CachingUserDetailsService<S>
impl<S> Sync for CachingUserDetailsService<S>
impl<S> Unpin for CachingUserDetailsService<S>where
S: Unpin,
impl<S> !UnwindSafe for CachingUserDetailsService<S>
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
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>
Converts
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>
Converts
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 more