pub enum CacheDriver {
Memory,
Redis,
RedisCluster,
Memcached,
DynamoDb,
}Expand description
Where cached values live.
The enum names every store this crate knows how to build, whether or not
the cargo feature behind it is on. That is deliberate: CACHE_DRIVER=redis
in a build without the redis-driver feature is a build mistake, and
it deserves a message saying so — not the same “unknown driver” message a
typo gets.
use rainier_cache::CacheDriver;
use rainier_support::Setting;
assert_eq!(CacheDriver::parse("redis-cluster").unwrap(), CacheDriver::RedisCluster);
assert!(CacheDriver::parse("redys").is_err());Variants§
Memory
This process only. Fast, and shares nothing between instances.
The default because it needs no server, and the right choice for
tests and single-process development. Anything cached for
correctness rather than for speed is wrong in it — a rate-limit
counter becomes N × its limit across N instances, and a lock is
not a lock.
Redis
One Redis server, or a Sentinel-fronted primary.
RedisCluster
A sharded Redis Cluster. Keys distribute across the seed nodes.
Memcached
Memcached over its text protocol.
DynamoDb
DynamoDB, with TTL doing the expiry. No server to run.
Implementations§
Source§impl CacheDriver
impl CacheDriver
Source§impl CacheDriver
impl CacheDriver
Whether this driver is shared between instances of the application.
The question a production checklist is really asking. A rate limiter, a
lock, or a cached authorisation decision needs true here; a memoised
computation does not.
Trait Implementations§
Source§impl AsRef<str> for CacheDriver
impl AsRef<str> for CacheDriver
Source§impl Clone for CacheDriver
impl Clone for CacheDriver
Source§fn clone(&self) -> CacheDriver
fn clone(&self) -> CacheDriver
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CacheDriver
Source§impl Debug for CacheDriver
impl Debug for CacheDriver
Source§impl Default for CacheDriver
impl Default for CacheDriver
Source§fn default() -> CacheDriver
fn default() -> CacheDriver
Source§impl<'de> Deserialize<'de> for CacheDriver
impl<'de> Deserialize<'de> for CacheDriver
Source§fn deserialize<D>(
deserializer: D,
) -> Result<CacheDriver, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<CacheDriver, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Display for CacheDriver
impl Display for CacheDriver
impl Eq for CacheDriver
Source§impl FromStr for CacheDriver
impl FromStr for CacheDriver
Source§impl Hash for CacheDriver
impl Hash for CacheDriver
Source§impl PartialEq for CacheDriver
impl PartialEq for CacheDriver
Source§impl Serialize for CacheDriver
impl Serialize for CacheDriver
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Source§impl Setting for CacheDriver
impl Setting for CacheDriver
Source§const SETTING: &'static str = "cache driver"
const SETTING: &'static str = "cache driver"
"cache driver". Read moreSource§const ALL: &'static [CacheDriver]
const ALL: &'static [CacheDriver]
impl StructuralPartialEq for CacheDriver
Auto Trait Implementations§
impl Freeze for CacheDriver
impl RefUnwindSafe for CacheDriver
impl Send for CacheDriver
impl Sync for CacheDriver
impl Unpin for CacheDriver
impl UnsafeUnpin for CacheDriver
impl UnwindSafe for CacheDriver
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Event for T
impl<T> Event for T
Source§fn event_name() -> &'static strwhere
Self: Sized,
fn event_name() -> &'static strwhere
Self: Sized,
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>
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>
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