[−][src]Struct cached_path::CacheBuilder
Builder to facilitate creating Cache
objects.
Implementations
impl CacheBuilder
[src]
pub fn new() -> CacheBuilder
[src]
Construct a new CacheBuilder
.
pub fn with_client_builder(client_builder: ClientBuilder) -> CacheBuilder
[src]
Construct a new CacheBuilder
with a ClientBuilder
.
pub fn dir(self, dir: PathBuf) -> CacheBuilder
[src]
Set the cache location. This can be set through the environment
variable RUST_CACHED_PATH_ROOT
. Otherwise it will default to a subdirectory
named 'cache' of the default system temp directory.
pub fn client_builder(self, client_builder: ClientBuilder) -> CacheBuilder
[src]
Set the ClientBuilder
.
pub fn timeout(self, timeout: Duration) -> CacheBuilder
[src]
Enable a request timeout.
pub fn connect_timeout(self, timeout: Duration) -> CacheBuilder
[src]
Enable a timeout for the connect phase of each HTTP request.
pub fn max_retries(self, max_retries: u32) -> CacheBuilder
[src]
Set maximum number of retries for HTTP requests.
pub fn max_backoff(self, max_backoff: u32) -> CacheBuilder
[src]
Set the maximum backoff delay in milliseconds for retrying HTTP requests.
pub fn freshness_lifetime(self, freshness_lifetime: u64) -> CacheBuilder
[src]
Set the default freshness lifetime, in seconds. The default is None, meaning the ETAG for an external resource will always be checked for a fresher value.
pub fn offline(self, offline: bool) -> CacheBuilder
[src]
Only use offline functionality.
If set to true
, when the cached path of an HTTP resource is requested,
the latest cached version is returned without checking for freshness.
But if no cached versions exist, a
NoCachedVersions
error is returned.
pub fn only_keep_latest(self, only_keep_latest: bool) -> CacheBuilder
[src]
Remove older cached versions of a resource when a newer version is cached.
In general, setting this to true
is not recommended because it could result
in deleting a cached file that another process is trying to read.
pub fn build(self) -> Result<Cache, Error>
[src]
Build the Cache
object.
Trait Implementations
impl Debug for CacheBuilder
[src]
impl Default for CacheBuilder
[src]
Auto Trait Implementations
impl !RefUnwindSafe for CacheBuilder
impl Send for CacheBuilder
impl Sync for CacheBuilder
impl Unpin for CacheBuilder
impl !UnwindSafe for CacheBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,