pub struct RedisClient {
pub db_name: String,
pub client: Client,
}
Fields§
§db_name: String
§client: Client
Implementations§
Source§impl RedisClient
impl RedisClient
pub fn connect(url: &str, db_name: &str) -> RedisResult<Self>
pub async fn get_con(&self) -> RedisResult<MultiplexedConnection>
pub async fn set_str( &self, key: &str, value: &str, ttl_seconds: i64, ) -> RedisResult<()>
pub async fn hset(&self, key: &str, field: &str, value: &str) -> RedisResult<()>
pub async fn hget(&self, key: &str, field: &str) -> RedisResult<String>
pub async fn hgetall(&self, key: &str) -> RedisResult<HashMap<String, String>>
pub async fn hdel(&self, key: &str, field: &str) -> RedisResult<()>
pub async fn get_str(&self, key: &str) -> RedisResult<String>
Trait Implementations§
Source§impl Clone for RedisClient
impl Clone for RedisClient
Source§fn clone(&self) -> RedisClient
fn clone(&self) -> RedisClient
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for RedisClient
impl RefUnwindSafe for RedisClient
impl Send for RedisClient
impl Sync for RedisClient
impl Unpin for RedisClient
impl UnwindSafe for RedisClient
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