pub struct SchemaCacheBuilder { /* private fields */ }Expand description
Builder for constructing a SchemaCache with sensible defaults.
Defaults:
cache_dir:ensure_cache_dir()force_fetch:falsettl:DEFAULT_SCHEMA_CACHE_TTL(12 hours)
§Examples
ⓘ
let cache = SchemaCache::builder().build();
let cache = SchemaCache::builder().force_fetch(true).ttl(Duration::from_secs(3600)).build();Implementations§
Source§impl SchemaCacheBuilder
impl SchemaCacheBuilder
Sourcepub fn force_fetch(self, force: bool) -> Self
pub fn force_fetch(self, force: bool) -> Self
When true, bypass cache reads and always fetch from the network.
Fetched schemas are still written to the cache.
Sourcepub fn cache_dir_or_default(&self) -> PathBuf
pub fn cache_dir_or_default(&self) -> PathBuf
Returns the cache directory that will be used, or ensure_cache_dir()
if none was explicitly set.
Useful when callers need the resolved path before calling build.
Sourcepub fn build(self) -> SchemaCache
pub fn build(self) -> SchemaCache
Build the SchemaCache.
Auto Trait Implementations§
impl Freeze for SchemaCacheBuilder
impl RefUnwindSafe for SchemaCacheBuilder
impl Send for SchemaCacheBuilder
impl Sync for SchemaCacheBuilder
impl Unpin for SchemaCacheBuilder
impl UnsafeUnpin for SchemaCacheBuilder
impl UnwindSafe for SchemaCacheBuilder
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