Enum Cache

Source
pub enum Cache {
    Redis(Redis),
    None,
}

Variants§

§

Redis(Redis)

§

None

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 db(&mut self, db: i8) -> Result<&mut dyn CacheBase, 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 delete(&mut self, key: &str) -> Result<bool, String>

Source

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

Source

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

Source

pub fn set_add(&mut self, key: &str, value: JsonValue) -> Result<bool, 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_message_queue( &mut self, key: &str, value: JsonValue, ) -> Result<bool, String>

Source

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

Source

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

Source

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

获取哈希值

Source

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

哈希-添加

Source

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

哈希-获取指定字段的值

Source

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

哈希-获取所有字段

Source

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

哈希-删除

Source

pub fn get_hash_values(&mut self, key: &str) -> Result<JsonValue, 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, 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<T> ErasedDestructor for T
where T: 'static,