pub struct Redis {
pool: RedisPool,
}
Expand description
A Redis-backed StoreBackend
implementation. The best option for most
links deployments.
§Configuration
Store backend name:
redis
Configuration:
cluster
: Use Redis cluster mode. If this is enabled, cluster information will be requested from Redis nodes (which will fail if the server isn’t in cluster mode).true
/false
. Defaultfalse
.connect
: Connection information in the format ofhost:port
to connect to. When using Redis in cluster mode, you can configure multiplehost:port
pairs seperated by commas for different nodes (i.e.host1:port1,host2:port2,host3:port3
), but only one is required (the others will be automatically discovered). Note that this is not a full URL, just the host and port.username
: The username to use for the connection, when using ACLs on the server. Don’t specify this when using password-based auth.password
: The password to use for the Redis connection. This can either be the user’s password (when using ACLs) or the global server password when using password-based authentication.database
: The database number to use for the Redis connection. Default0
.tls
: Enable TLS (using system root CAs) when communicating with the Redis server.true
/false
. Defaultfalse
.pool_size
: The number of connections to use in the connection pool. Default8
.
Fields§
§pool: RedisPool
Trait Implementations§
Source§impl StoreBackend for Store
impl StoreBackend for Store
Source§fn store_type() -> BackendTypewhere
Self: Sized,
fn store_type() -> BackendTypewhere
Self: Sized,
Get this implementation’s backend store type. This is used in
e.g. the configuration.
Source§fn get_store_type(&self) -> BackendType
fn get_store_type(&self) -> BackendType
Get this implementation’s backend store type. This can be used on trait
objects, but is otherwise equivalent to calling
Self::store_type()
.Source§fn new<'life0, 'async_trait>(
config: &'life0 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn new<'life0, 'async_trait>(
config: &'life0 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a new instance of this
StoreBackend
. Configuration is provided
as a collection of pico-args
arguments beginning with --store-
. For
details about configuring each store backend, see that backend’s
documentation.Source§fn get_redirect<'life0, 'async_trait>(
&'life0 self,
from: Id,
) -> Pin<Box<dyn Future<Output = Result<Option<Link>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_redirect<'life0, 'async_trait>(
&'life0 self,
from: Id,
) -> Pin<Box<dyn Future<Output = Result<Option<Link>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get a redirect. Returns the full
to
link corresponding to the from
links ID. A link not existing is not an error, if no matching link is
found, Ok(None)
is returned. Read moreSource§fn set_redirect<'life0, 'async_trait>(
&'life0 self,
from: Id,
to: Link,
) -> Pin<Box<dyn Future<Output = Result<Option<Link>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_redirect<'life0, 'async_trait>(
&'life0 self,
from: Id,
to: Link,
) -> Pin<Box<dyn Future<Output = Result<Option<Link>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set a redirect.
from
is the ID of the link, while to
is the full
destination link. If a mapping with this ID already exists, it must be
changed to the new one, returning the old one. Read moreSource§fn rem_redirect<'life0, 'async_trait>(
&'life0 self,
from: Id,
) -> Pin<Box<dyn Future<Output = Result<Option<Link>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn rem_redirect<'life0, 'async_trait>(
&'life0 self,
from: Id,
) -> Pin<Box<dyn Future<Output = Result<Option<Link>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Remove a redirect.
from
is the ID of the links link to be removed.
Returns the old value of the mapping or None
if there was no such
mapping. Read moreSource§fn get_vanity<'life0, 'async_trait>(
&'life0 self,
from: Normalized,
) -> Pin<Box<dyn Future<Output = Result<Option<Id>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_vanity<'life0, 'async_trait>(
&'life0 self,
from: Normalized,
) -> Pin<Box<dyn Future<Output = Result<Option<Id>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get a vanity path’s ID. Returns the ID of the
to
link corresponding
to the from
vanity path. An ID not existing is not an error, if no
matching ID is found, None
is returned. Read moreSource§fn set_vanity<'life0, 'async_trait>(
&'life0 self,
from: Normalized,
to: Id,
) -> Pin<Box<dyn Future<Output = Result<Option<Id>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_vanity<'life0, 'async_trait>(
&'life0 self,
from: Normalized,
to: Id,
) -> Pin<Box<dyn Future<Output = Result<Option<Id>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set a vanity path for an ID.
from
is the vanity path of the links ID,
while to
is the ID itself. If a vanity link with this path already
exists, it must be changed to the new one, returning the old one. Read moreSource§fn rem_vanity<'life0, 'async_trait>(
&'life0 self,
from: Normalized,
) -> Pin<Box<dyn Future<Output = Result<Option<Id>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn rem_vanity<'life0, 'async_trait>(
&'life0 self,
from: Normalized,
) -> Pin<Box<dyn Future<Output = Result<Option<Id>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Remove a vanity path.
from
is the vanity path to be removed. Returns
the old value of the mapping or None
if there was no such mapping. Read moreSource§fn get_statistics<'life0, 'async_trait>(
&'life0 self,
description: StatisticDescription,
) -> Pin<Box<dyn Future<Output = Result<Vec<(Statistic, StatisticValue)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_statistics<'life0, 'async_trait>(
&'life0 self,
description: StatisticDescription,
) -> Pin<Box<dyn Future<Output = Result<Vec<(Statistic, StatisticValue)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get statistics’ values by their description. Returns all matching
Statistic
s and their values for the provided
StatisticDescription
. Statistics not having been collected is not an
error, if no matching statistics are found, an empty Vec
is
returned. Read moreSource§fn incr_statistic<'life0, 'async_trait>(
&'life0 self,
statistic: Statistic,
) -> Pin<Box<dyn Future<Output = Result<Option<StatisticValue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn incr_statistic<'life0, 'async_trait>(
&'life0 self,
statistic: Statistic,
) -> Pin<Box<dyn Future<Output = Result<Option<StatisticValue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn rem_statistics<'life0, 'async_trait>(
&'life0 self,
description: StatisticDescription,
) -> Pin<Box<dyn Future<Output = Result<Vec<(Statistic, StatisticValue)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn rem_statistics<'life0, 'async_trait>(
&'life0 self,
description: StatisticDescription,
) -> Pin<Box<dyn Future<Output = Result<Vec<(Statistic, StatisticValue)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Remove statistics by their description. Deletes all
Statistic
s that
match the provided StatisticDescription
and returns their values
before they were deleted, if they’re available. A statistic not having
been collected is not an error, if no matching statistics are found, an
empty Vec
is returned. Read moreAuto Trait Implementations§
impl Freeze for Store
impl !RefUnwindSafe for Store
impl Send for Store
impl Sync for Store
impl Unpin for Store
impl !UnwindSafe for Store
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request