pub struct ThingsCache { /* private fields */ }
Expand description
Main cache manager for Things 3 data
Implementations§
Source§impl ThingsCache
impl ThingsCache
Sourcepub fn new(config: CacheConfig) -> Self
pub fn new(config: CacheConfig) -> Self
Create a new cache with the given configuration
Sourcepub fn new_default() -> Self
pub fn new_default() -> Self
Create a new cache with default configuration
Sourcepub async fn get_tasks<F, Fut>(
&self,
key: &str,
fetcher: F,
) -> Result<Vec<Task>>
pub async fn get_tasks<F, Fut>( &self, key: &str, fetcher: F, ) -> Result<Vec<Task>>
Get tasks from cache or execute the provided function
Sourcepub async fn get_projects<F, Fut>(
&self,
key: &str,
fetcher: F,
) -> Result<Vec<Project>>
pub async fn get_projects<F, Fut>( &self, key: &str, fetcher: F, ) -> Result<Vec<Project>>
Get projects from cache or execute the provided function
Sourcepub async fn get_areas<F, Fut>(
&self,
key: &str,
fetcher: F,
) -> Result<Vec<Area>>
pub async fn get_areas<F, Fut>( &self, key: &str, fetcher: F, ) -> Result<Vec<Area>>
Get areas from cache or execute the provided function
Sourcepub async fn get_search_results<F, Fut>(
&self,
key: &str,
fetcher: F,
) -> Result<Vec<Task>>
pub async fn get_search_results<F, Fut>( &self, key: &str, fetcher: F, ) -> Result<Vec<Task>>
Get search results from cache or execute the provided function
Sourcepub async fn invalidate_all(&self)
pub async fn invalidate_all(&self)
Invalidate all caches
Sourcepub async fn invalidate(&self, key: &str)
pub async fn invalidate(&self, key: &str)
Invalidate specific cache entry
Sourcepub fn get_stats(&self) -> CacheStats
pub fn get_stats(&self) -> CacheStats
Get cache statistics
Sourcepub fn reset_stats(&self)
pub fn reset_stats(&self)
Reset cache statistics
Auto Trait Implementations§
impl Freeze for ThingsCache
impl !RefUnwindSafe for ThingsCache
impl Send for ThingsCache
impl Sync for ThingsCache
impl Unpin for ThingsCache
impl !UnwindSafe for ThingsCache
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more