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) -> Self
pub fn eviction_strategy(self, strategy: EvictionStrategy) -> Self
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<Self, Self::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