Skip to main content

FifoCache

Struct FifoCache 

Source
pub struct FifoCache { /* private fields */ }
Expand description

A FIFO cache, that shares global state along all incoming requests of a policy.

As the name suggests, a FIFO eviction strategy is used, meaning that when the maximum number of entries is reached, the first added cache entries will be the first to be evicted.

Implementations§

Source§

impl FifoCache

Source

pub fn max_entries_size(&self) -> usize

Get the cache’s maximum number of entries available.

Source

pub fn cache_id(&self) -> &str

Returns cache ID.

Trait Implementations§

Source§

impl Cache for FifoCache

Source§

fn save(&self, key: &str, value: Vec<u8>) -> Result<(), CacheError>

Stores value in cache with provided key. Value should be already serialized. Read more
Source§

fn get(&self, key: &str) -> Option<Vec<u8>>

Returns stored value in cache for provided key. Read more
Source§

fn delete(&self, key: &str) -> Option<Vec<u8>>

Removes an element from cache by key. Read more
Source§

fn purge(&self)

Clears all elements in cache.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<C, T> Extract<T> for C
where T: FromContext<C>,

Source§

type Error = <T as FromContext<C>>::Error

Source§

fn extract(&self) -> Result<T, <C as Extract<T>>::Error>

Source§

fn extract_always(&self) -> T
where Self: Extract<T, Error = Infallible>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.