pub struct QueryClient { /* private fields */ }Expand description
The main query client
Implementations§
Source§impl QueryClient
impl QueryClient
Sourcepub fn with_settings(stale_time: Duration, cache_time: Duration) -> Self
pub fn with_settings(stale_time: Duration, cache_time: Duration) -> Self
Create a new query client with custom settings
Sourcepub fn get_cache_entry(&self, key: &QueryKey) -> Option<CacheEntry>
pub fn get_cache_entry(&self, key: &QueryKey) -> Option<CacheEntry>
Get a cache entry for a query key
Sourcepub fn set_query_data<T: Serialize>(
&self,
key: &QueryKey,
data: T,
) -> Result<(), QueryError>
pub fn set_query_data<T: Serialize>( &self, key: &QueryKey, data: T, ) -> Result<(), QueryError>
Set query data in the cache
Sourcepub fn get_query_data<T: DeserializeOwned>(&self, key: &QueryKey) -> Option<T>
pub fn get_query_data<T: DeserializeOwned>(&self, key: &QueryKey) -> Option<T>
Get query data from the cache
Sourcepub fn remove_query(&self, key: &QueryKey)
pub fn remove_query(&self, key: &QueryKey)
Remove a query from the cache
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Clear all queries from the cache
Sourcepub fn cache_stats(&self) -> CacheStats
pub fn cache_stats(&self) -> CacheStats
Get cache statistics
Sourcepub fn get_cache_entries(&self) -> Vec<(QueryKey, CacheEntry)>
pub fn get_cache_entries(&self) -> Vec<(QueryKey, CacheEntry)>
Get all cache entries (for DevTools)
Sourcepub fn invalidate_queries(&self, pattern: &QueryKeyPattern)
pub fn invalidate_queries(&self, pattern: &QueryKeyPattern)
Invalidate queries matching a pattern
Sourcepub fn cleanup_stale_entries(&self)
pub fn cleanup_stale_entries(&self)
Clean up stale entries
Sourcepub async fn fetch_infinite_page<T: Clone + Serialize + DeserializeOwned>(
&self,
_key: &QueryKey,
_page: usize,
) -> Result<Page<T>, QueryError>
pub async fn fetch_infinite_page<T: Clone + Serialize + DeserializeOwned>( &self, _key: &QueryKey, _page: usize, ) -> Result<Page<T>, QueryError>
Infinite query support methods Fetch a specific page for infinite queries
Sourcepub fn get_infinite_options(&self, _key: &QueryKey) -> InfiniteQueryOptions
pub fn get_infinite_options(&self, _key: &QueryKey) -> InfiniteQueryOptions
Get infinite query options for a key
Sourcepub fn register_infinite_observer(&self, _key: &QueryKey) -> QueryObserverId
pub fn register_infinite_observer(&self, _key: &QueryKey) -> QueryObserverId
Register an infinite query observer
Trait Implementations§
Source§impl Clone for QueryClient
impl Clone for QueryClient
Source§fn clone(&self) -> QueryClient
fn clone(&self) -> QueryClient
Returns a duplicate 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 QueryClient
impl !RefUnwindSafe for QueryClient
impl Send for QueryClient
impl Sync for QueryClient
impl Unpin for QueryClient
impl !UnwindSafe for QueryClient
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.