pub struct QueryCache { /* private fields */ }Expand description
Query result cache
Implementations§
Source§impl QueryCache
impl QueryCache
Sourcepub fn new(config: CacheConfig) -> Self
pub fn new(config: CacheConfig) -> Self
Create a new query cache
Sourcepub async fn get<T>(&self, query: &str) -> Option<Vec<T>>where
T: for<'de> Deserialize<'de>,
pub async fn get<T>(&self, query: &str) -> Option<Vec<T>>where
T: for<'de> Deserialize<'de>,
Get cached query results
Sourcepub async fn set<T>(&self, query: &str, data: Vec<T>) -> SfResult<()>where
T: Serialize,
pub async fn set<T>(&self, query: &str, data: Vec<T>) -> SfResult<()>where
T: Serialize,
Store query results in cache
Sourcepub async fn invalidate(&self, query: &str)
pub async fn invalidate(&self, query: &str)
Invalidate cached query results
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics
Auto Trait Implementations§
impl Freeze for QueryCache
impl !RefUnwindSafe for QueryCache
impl Send for QueryCache
impl Sync for QueryCache
impl Unpin for QueryCache
impl !UnwindSafe for QueryCache
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