pub struct CachePolicyTable { /* private fields */ }Expand description
Per-route cache headers derived from the built manifest. Empty = no route
declared a non-inert policy, and every apply is a no-op.
Implementations§
Source§impl CachePolicyTable
impl CachePolicyTable
Sourcepub fn from_routes(routes: &[Route]) -> Self
pub fn from_routes(routes: &[Route]) -> Self
Build from the manifest’s routes. Routes whose policy is inert
({ ttl: 0 } — the “never cache this” every route file writes) produce
no rule, so the table stays empty for the common workload and this
layer costs one is_empty per response.
Sourcepub fn from_manifest_json(raw: &[u8]) -> Result<Self>
pub fn from_manifest_json(raw: &[u8]) -> Result<Self>
Build from a built manifest.json’s bytes.
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Sourcepub fn cache_control_for(&self, path: &str) -> Option<&str>
pub fn cache_control_for(&self, path: &str) -> Option<&str>
The Cache-Control a 2xx at path must carry, or None when no
route declared a positive policy for it.
The header-free accessor exists for the publish path, which stamps a
value onto an object at PUT time rather than onto a live response and
has no axum dependency of its own. Same rules, same first-match-wins
order — a second derivation over there is precisely the drift this
module was pulled down into mesofact-core to prevent.
Sourcepub fn apply(&self, path: &str, status: StatusCode, headers: &mut HeaderMap)
pub fn apply(&self, path: &str, status: StatusCode, headers: &mut HeaderMap)
Stamp the first matching route’s derived headers onto headers.
First match wins, matching the manifest’s own routing rule — the same
discipline mesofact::route_headers states for the domain table.
Trait Implementations§
Source§impl Clone for CachePolicyTable
impl Clone for CachePolicyTable
Source§impl Debug for CachePolicyTable
impl Debug for CachePolicyTable
Source§impl Default for CachePolicyTable
impl Default for CachePolicyTable
impl Eq for CachePolicyTable
Source§impl PartialEq for CachePolicyTable
impl PartialEq for CachePolicyTable
impl StructuralPartialEq for CachePolicyTable
Auto Trait Implementations§
impl Freeze for CachePolicyTable
impl RefUnwindSafe for CachePolicyTable
impl Send for CachePolicyTable
impl Sync for CachePolicyTable
impl Unpin for CachePolicyTable
impl UnsafeUnpin for CachePolicyTable
impl UnwindSafe for CachePolicyTable
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.