Skip to main content

Redis

Struct Redis 

Source
pub struct Redis {
    pub url: String,
    pub client: Option<Client>,
}

Fields§

§url: String§client: Option<Client>

Trait Implementations§

Source§

impl CacheProvider for Redis

Source§

fn get( &self, cache_space: CacheSpace, key: &str, app_name: Option<String>, ) -> String

Source§

fn set( &self, cache_space: CacheSpace, key: &str, value: Value, app_name: Option<String>, )

Source§

fn delete(&self, cache_space: CacheSpace, key: &str, app_name: Option<String>)

Source§

fn set_with_ttl( &self, cache_space: CacheSpace, key: &str, value: Value, app_name: Option<String>, ttl_secs: u64, )

Set a key with an explicit TTL in seconds. Defaults to set (no expiry) if not overridden.
Source§

fn get_key_name( &self, cache_space: CacheSpace, key: &str, app_name: Option<String>, ) -> String

Source§

fn get_value(&self, app_name: Option<String>, value: Value) -> CacheValue<Value>

Source§

impl Connectable for Redis

Source§

fn set_client(&mut self)

Source§

fn get_connection(&self) -> &Client

Source§

fn get_mut_connection(&mut self) -> &mut Client

Source§

impl FifoProvider for Redis

Source§

fn pop( &self, channel_name: ListChannel, job_key: &str, ) -> Result<ListMessage, &'static str>

Source§

fn push(&self, channel_name: ListChannel, job_key: &str, job_payload: Value)

Source§

fn get_list_name(&self, channel_name: &str, job_key: &str) -> String

Source§

impl ProviderTrait for Redis

Source§

fn new(url: String) -> Self

Source§

impl PubSubProvider for Redis

Source§

type Channels = SubscriptionChannel

Source§

fn subscribe( &self, callback: AsyncCallback<ChannelMessage>, channel: Self::Channels, ) -> Pin<Box<dyn Future<Output = Result<(), PubSubProviderError>> + Send + '_>>

Source§

fn publish(&mut self, channel: Self::Channels, message: ChannelMessage)

Source§

impl SortedSetProvider for Redis

Source§

fn zadd(&self, key: &str, score: f64, member: &str) -> Result<u32, &'static str>

Add a member with the given score. Returns the number of new elements added.
Source§

fn zremrangebyscore( &self, key: &str, min: f64, max: f64, ) -> Result<u32, &'static str>

Remove all members with scores between min and max (inclusive). Returns the number of removed members.
Source§

fn zcard(&self, key: &str) -> Result<u32, &'static str>

Return the number of members in the sorted set.
Source§

fn zrangebyscore_withscores( &self, key: &str, min: f64, max: f64, limit: Option<usize>, ) -> Result<Vec<(String, f64)>, &'static str>

Return members with scores in the given range, ordered by score ascending. Includes scores in the result as (member, score) pairs.
Source§

fn expire(&self, key: &str, ttl_secs: u64) -> Result<(), &'static str>

Set a TTL (in seconds) on the key. Useful for auto-cleanup of sliding windows.
Source§

fn eval_script( &self, script: &str, keys: &[&str], args: &[&str], ) -> Result<Vec<i64>, &'static str>

Execute a Lua script with the given keys and args. Returns a vector of integers.

Auto Trait Implementations§

§

impl Freeze for Redis

§

impl RefUnwindSafe for Redis

§

impl Send for Redis

§

impl Sync for Redis

§

impl Unpin for Redis

§

impl UnsafeUnpin for Redis

§

impl UnwindSafe for Redis

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<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, 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.
Source§

impl<T> ConnectableCacheProvider for T

Source§

impl<T> ConnectableFifoProvider for T

Source§

impl<T> ConnectableProvider for T

Source§

impl<T> ConnectablePubSubProvider for T

Source§

impl<T> ConnectableSortedSetProvider for T

Source§

impl<T> ErasedDestructor for T
where T: 'static,