governor::state::keyed

Type Alias DashMapStateStore

Source
pub type DashMapStateStore<K> = DashMap<K, InMemoryState>;
Expand description

A concurrent, thread-safe and fairly performant hashmap based on DashMap.

Aliased Type§

struct DashMapStateStore<K> { /* private fields */ }

Trait Implementations§

Source§

impl<K: Hash + Eq + Clone> ShrinkableKeyedStateStore<K> for DashMapStateStore<K>

Source§

fn retain_recent(&self, drop_below: Nanos)

Remove those keys with state older than drop_below.
Source§

fn shrink_to_fit(&self)

Shrinks the capacity of the state store, if possible. Read more
Source§

fn len(&self) -> usize

Returns the number of “live” keys stored in the state store. Read more
Source§

fn is_empty(&self) -> bool

Returns true if self has no keys stored in it. Read more
Source§

impl<K: Hash + Eq + Clone> StateStore for DashMapStateStore<K>

Source§

type Key = K

The type of key that the state store can represent.
Source§

fn measure_and_replace<T, F, E>(&self, key: &Self::Key, f: F) -> Result<T, E>
where F: Fn(Option<Nanos>) -> Result<(T, Nanos), E>,

Updates a state store’s rate limiting state for a given key, using the given closure. Read more