pub struct FsCacheStore { /* private fields */ }Expand description
文件系统缓存存储
对应 TypeScript 版本的 FsCacheStore
Implementations§
Source§impl FsCacheStore
impl FsCacheStore
Sourcepub fn new(options: CacheOptions) -> CacheResult<Self>
pub fn new(options: CacheOptions) -> CacheResult<Self>
Sourcepub fn get<T>(&self, key: &str) -> CacheResult<Option<T>>where
T: for<'de> Deserialize<'de>,
pub fn get<T>(&self, key: &str) -> CacheResult<Option<T>>where
T: for<'de> Deserialize<'de>,
获取缓存值
对应 TypeScript 版本的 get
Sourcepub fn set<T>(&self, key: &str, value: T, ttl: Option<i64>) -> CacheResult<()>where
T: Serialize,
pub fn set<T>(&self, key: &str, value: T, ttl: Option<i64>) -> CacheResult<()>where
T: Serialize,
设置缓存值
对应 TypeScript 版本的 set
Sourcepub fn del(&self, key: &str) -> CacheResult<()>
pub fn del(&self, key: &str) -> CacheResult<()>
删除缓存
对应 TypeScript 版本的 del
Sourcepub fn reset(&self) -> CacheResult<()>
pub fn reset(&self) -> CacheResult<()>
重置所有缓存
对应 TypeScript 版本的 reset
Auto Trait Implementations§
impl !Freeze for FsCacheStore
impl !RefUnwindSafe for FsCacheStore
impl Send for FsCacheStore
impl Sync for FsCacheStore
impl Unpin for FsCacheStore
impl UnsafeUnpin for FsCacheStore
impl UnwindSafe for FsCacheStore
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