pub struct TileCacheStrategy {
pub zoom_policies: Vec<(u8, u8, CachePolicy)>,
pub default_policy: CachePolicy,
}Expand description
Zoom-level-aware caching strategy for map tiles.
Fields§
§zoom_policies: Vec<(u8, u8, CachePolicy)>Ordered list of (min_zoom, max_zoom, policy) bands.
default_policy: CachePolicyFallback policy when no band matches the requested zoom level.
Implementations§
Source§impl TileCacheStrategy
impl TileCacheStrategy
Sourcepub fn standard_tile_strategy() -> Self
pub fn standard_tile_strategy() -> Self
Returns the standard multi-tier tile caching strategy:
| Zoom | Policy |
|---|---|
| 0–7 | public, 24 h, swr 1 h, sie 7 d |
| 8–12 | public, 1 h, swr 60 s, sie 24 h |
| 13–16 | public, 5 min, swr 30 s, sie 1 h |
| 17–22 | no-cache |
Sourcepub fn policy_for_zoom(&self, zoom: u8) -> &CachePolicy
pub fn policy_for_zoom(&self, zoom: u8) -> &CachePolicy
Returns the CachePolicy appropriate for the given zoom level.
Sourcepub fn headers_for_tile(&self, zoom: u8, tile_data: &[u8]) -> CacheHeaders
pub fn headers_for_tile(&self, zoom: u8, tile_data: &[u8]) -> CacheHeaders
Builds CacheHeaders for a tile at zoom with content tile_data.
The ETag is derived from the tile bytes; Vary: Accept-Encoding is
always set.
Trait Implementations§
Source§impl Clone for TileCacheStrategy
impl Clone for TileCacheStrategy
Source§fn clone(&self) -> TileCacheStrategy
fn clone(&self) -> TileCacheStrategy
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 moreSource§impl Debug for TileCacheStrategy
impl Debug for TileCacheStrategy
Auto Trait Implementations§
impl Freeze for TileCacheStrategy
impl RefUnwindSafe for TileCacheStrategy
impl Send for TileCacheStrategy
impl Sync for TileCacheStrategy
impl Unpin for TileCacheStrategy
impl UnsafeUnpin for TileCacheStrategy
impl UnwindSafe for TileCacheStrategy
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 more