pub struct CacheService {
pub inner: Box<dyn ICacheService>,
}Fields§
§inner: Box<dyn ICacheService>Implementations§
Source§impl CacheService
impl CacheService
pub fn new(cfg: &ApplicationConfig) -> Self
pub fn new_saved(cfg: &ApplicationConfig) -> Self
pub async fn set_string(&self, k: &str, v: &str) -> Result<String>
pub async fn get_string(&self, k: &str) -> Result<String>
pub async fn del_string(&self, k: &str) -> Result<String>
pub async fn set_json<T>(&self, k: &str, v: &T) -> Result<String>
pub async fn get_json<T>(&self, k: &str) -> Result<T>where
T: DeserializeOwned + Sync,
pub async fn set_string_ex( &self, k: &str, v: &str, ex: Option<Duration>, ) -> Result<String>
pub async fn ttl(&self, k: &str) -> Result<i64>
Auto Trait Implementations§
impl Freeze for CacheService
impl !RefUnwindSafe for CacheService
impl Send for CacheService
impl Sync for CacheService
impl Unpin for CacheService
impl !UnwindSafe for CacheService
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