pub struct CacheBuilder { /* private fields */ }Expand description
Represents the base builder for a Cache instance.
Implementations§
Source§impl CacheBuilder
impl CacheBuilder
Sourcepub fn new(&self, cache_id: String) -> CacheBuilderInstance
pub fn new(&self, cache_id: String) -> CacheBuilderInstance
Returns a CacheBuilderInstance with an ID to uniquely identify the cache.
Note: if 2 caches are assigned the same ID in a same policy, they will share the state. This behavior is extended to other policies when using the shared cache option.
Sourcepub fn eviction_strategy(self, strategy: EvictionStrategy) -> CacheBuilder
pub fn eviction_strategy(self, strategy: EvictionStrategy) -> CacheBuilder
Sets the eviction strategy for all caches created by this builder.
Default is EvictionStrategy::Fifo.
Trait Implementations§
Source§impl FromContext<ConfigureContext> for CacheBuilder
CacheBuilder can be injected in your configuration function.
impl FromContext<ConfigureContext> for CacheBuilder
CacheBuilder can be injected in your configuration function.
#[entrypoint]
async fn configure(
launcher: Launcher,
cache_builder: CacheBuilder,
Configuration(configuration): Configuration,
) -> anyhow::Result<()> {
// configure the cache here.
}type Error = !
fn from_context( context: &ConfigureContext, ) -> Result<CacheBuilder, <CacheBuilder as FromContext<ConfigureContext>>::Error>
fn from_context_always(context: &C) -> Selfwhere
Self: FromContext<C, E, Error = !>,
Auto Trait Implementations§
impl !RefUnwindSafe for CacheBuilder
impl !Send for CacheBuilder
impl !Sync for CacheBuilder
impl !UnwindSafe for CacheBuilder
impl Freeze for CacheBuilder
impl Unpin for CacheBuilder
impl UnsafeUnpin for CacheBuilder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<C, T> Extract<T> for Cwhere
T: FromContext<C>,
impl<C, T> Extract<T> for Cwhere
T: FromContext<C>,
Source§impl<C, T> FromContextOnce<C, Repeat> for Twhere
T: for<'c> FromContext<C> + 'c,
impl<C, T> FromContextOnce<C, Repeat> for Twhere
T: for<'c> FromContext<C> + 'c,
type Error = <T as FromContext<C>>::Error
type Future<'c> = Ready<Result<T, <T as FromContextOnce<C, Repeat>>::Error>> where C: 'c, T: 'c
fn from_context_once( context: Exclusive<'_, C>, ) -> <T as FromContextOnce<C, Repeat>>::Future<'_>
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