Skip to main content

Cache

Struct Cache 

Source
pub struct Cache { /* private fields */ }

Implementations§

Source§

impl Cache

Source

pub fn new(config: Config) -> Self

Source

pub fn create(name: &str, connection: Connection) -> Self

Source

pub fn connections(&mut self) -> JsonValue

Source

pub fn connection(&mut self, name: &str) -> Self

Source

pub fn none() -> Self

Source

pub fn is_none(&self) -> bool

Source

pub fn is_redis(&self) -> bool

Source

pub fn is_kafka(&self) -> bool

Source

pub fn mode(&self) -> &'static str

Source

pub fn ping(&mut self) -> Result<JsonValue, String>

Source

pub fn redis_ping(&mut self) -> Result<bool, String>

Source

pub fn redis_publish( &mut self, key: &str, value: JsonValue, ) -> Result<bool, String>

Source

pub fn kafka_ping(&self) -> Result<bool, String>

Source§

impl Cache

Source

pub fn db(&mut self, db: i8) -> &mut Self

Source

pub fn key_exists(&mut self, key: &str) -> Result<bool, String>

Source

pub fn key_del(&mut self, key: &str) -> Result<bool, String>

Source

pub fn key_ttl(&mut self, key: &str) -> Result<i64, String>

Source

pub fn key_set_expireat( &mut self, key: &str, timestamp: i64, ) -> Result<bool, String>

Source

pub fn key_set_seconds(&mut self, key: &str, s: i64) -> Result<bool, String>

Source

pub fn key_del_expire(&mut self, key: &str) -> Result<bool, String>

Source

pub fn key_query(&mut self, key: &str) -> Result<JsonValue, String>

Source

pub fn add( &mut self, key: &str, value: JsonValue, expiration_date: u64, ) -> Result<bool, String>

Source

pub fn get(&mut self, key: &str) -> Result<JsonValue, String>

Source

pub fn set_add( &mut self, key: &str, value: JsonValue, expiry_s: i64, ) -> Result<bool, String>

Source

pub fn set_count(&mut self, key: &str) -> Result<usize, String>

Source

pub fn set_get(&mut self, key: &str) -> Result<JsonValue, String>

Source

pub fn set_delete( &mut self, key: &str, value: JsonValue, ) -> Result<bool, String>

Source

pub fn set_get_sinter(&mut self, keys: Vec<&str>) -> Result<JsonValue, String>

Source

pub fn set_get_sunion(&mut self, keys: Vec<&str>) -> Result<JsonValue, String>

Source

pub fn list_add( &mut self, key: &str, value: JsonValue, expiry_s: i64, ) -> Result<bool, String>

Source

pub fn list_del(&mut self, key: &str, value: JsonValue) -> Result<bool, String>

Source

pub fn list_lpush( &mut self, key: &str, value: JsonValue, expiry_s: i64, ) -> Result<bool, String>

Source

pub fn list_rpush( &mut self, key: &str, value: JsonValue, expiry_s: i64, ) -> Result<bool, String>

Source

pub fn list_lpop( &mut self, key: &str, count: usize, ) -> Result<Vec<JsonValue>, String>

Source

pub fn list_rpop( &mut self, key: &str, count: usize, ) -> Result<Vec<JsonValue>, String>

Source

pub fn list_len(&mut self, key: &str) -> Result<usize, String>

Source

pub fn list_range( &mut self, key: &str, start: isize, stop: isize, ) -> Result<Vec<JsonValue>, String>

Source

pub fn list_all(&mut self, key: &str) -> Result<Vec<JsonValue>, String>

Source

pub fn list_get(&mut self, key: &str, index: isize) -> Result<JsonValue, String>

Source

pub fn list_trim( &mut self, key: &str, start: isize, stop: isize, ) -> Result<bool, String>

Source

pub fn list_set( &mut self, key: &str, index: isize, value: JsonValue, ) -> Result<bool, String>

Source

pub fn list_remove( &mut self, key: &str, value: JsonValue, count: isize, ) -> Result<isize, String>

Source

pub fn hash_get(&mut self, key: &str) -> Result<JsonValue, String>

Source

pub fn hash_add( &mut self, key: &str, field: &str, value: JsonValue, ) -> Result<bool, String>

Source

pub fn hash_get_field_value( &mut self, key: &str, field: &str, ) -> Result<JsonValue, String>

Source

pub fn hash_get_fields(&mut self, key: &str) -> Result<JsonValue, String>

Source

pub fn hash_delete(&mut self, key: &str, field: &str) -> Result<bool, String>

Source

pub fn hash_get_values(&mut self, key: &str) -> Result<JsonValue, String>

Source

pub fn geo_add( &mut self, key: &str, longitude: f64, latitude: f64, value: JsonValue, ) -> Result<bool, String>

Source

pub fn geo_get( &mut self, key: &str, value: JsonValue, ) -> Result<JsonValue, String>

Source

pub fn geo_dist( &mut self, key: &str, value1: JsonValue, value2: JsonValue, ) -> Result<JsonValue, String>

Source

pub fn geo_radius( &mut self, key: &str, value: JsonValue, radius: &str, ) -> Result<JsonValue, String>

Source

pub fn stream_add( &mut self, key: &str, msg_id: &str, field: &str, value: JsonValue, ) -> Result<String, String>

Source

pub fn stream_count(&mut self, key: &str) -> Result<usize, String>

Source

pub fn stream_get(&mut self, key: &str) -> Result<JsonValue, String>

Source

pub fn stream_del(&mut self, key: &str, id: &str) -> Result<bool, String>

Source

pub fn stream_group_create( &mut self, key: &str, group: &str, ) -> Result<bool, String>

Source

pub fn stream_group_add_user( &mut self, key: &str, group: &str, user: &str, ) -> Result<bool, String>

Source

pub fn stream_group_del_user( &mut self, key: &str, group: &str, user: &str, ) -> Result<bool, String>

Source

pub fn stream_group_del( &mut self, key: &str, group: &str, ) -> Result<bool, String>

Source

pub fn stream_group_msg( &mut self, key: &str, group: &str, user: &str, ) -> Result<JsonValue, String>

Source

pub fn stream_get_group( &mut self, key: &str, group: &str, ) -> Result<bool, String>

Source

pub fn stream_get_stream(&mut self, key: &str) -> Result<JsonValue, String>

Source

pub fn subscribe( &mut self, key: &str, tx: Sender<JsonValue>, ) -> Result<(), String>

Source

pub fn subscribe_with_reconnect( &self, key: &str, tx: Sender<JsonValue>, ) -> Result<(), String>

Source

pub fn publish(&mut self, key: &str, value: JsonValue) -> Result<bool, String>

Source§

impl Cache

Source

pub fn kafka_get_topics(&self) -> Result<Vec<String>, String>

Source

pub fn kafka_create_topic(&self, topic: &str) -> Result<bool, String>

Source

pub fn kafka_consume( &self, topic: &str, key: &str, only_one: bool, ) -> Result<JsonValue, String>

Source

pub fn kafka_publish_with_key( &self, topic: &str, key: &str, data: JsonValue, ) -> Result<bool, String>

Trait Implementations§

Source§

impl Clone for Cache

Source§

fn clone(&self) -> Cache

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl Freeze for Cache

§

impl !RefUnwindSafe for Cache

§

impl Send for Cache

§

impl Sync for Cache

§

impl Unpin for Cache

§

impl !UnwindSafe for Cache

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more