pub struct BoxedCacheInvalidator { /* private fields */ }Expand description
Built-in invalidator over the same BoxedCache the public
CachePageLayer uses. Keys come from the framework’s own
CachePageLayer::invalidate, which purges every cached variant of
a path (any query, any vary value), under the tenant it is given.
Implementations§
Source§impl BoxedCacheInvalidator
impl BoxedCacheInvalidator
Sourcepub fn new(cache: BoxedCache, key_prefix: impl Into<String>) -> Self
pub fn new(cache: BoxedCache, key_prefix: impl Into<String>) -> Self
Build a new invalidator targeting cache with the public
router’s key_prefix.
Sourcepub fn with_tenant_hosts(
self,
tenant_slug: impl Into<String>,
hosts: impl IntoIterator<Item = String>,
) -> Self
pub fn with_tenant_hosts( self, tenant_slug: impl Into<String>, hosts: impl IntoIterator<Item = String>, ) -> Self
Map a tenant slug to one or more Host header values. Both
acme.localhost and acme.localhost:8090 should be added
when the same site is reachable via both.
Sourcepub fn with_default_hosts(self, hosts: impl IntoIterator<Item = String>) -> Self
pub fn with_default_hosts(self, hosts: impl IntoIterator<Item = String>) -> Self
Fallback host list — used when a tenant slug isn’t in the per-tenant map. Set this in single-tenant deployments where every CMS URL lives under the same Host.
Sourcepub fn with_vary_values(
self,
pairs: impl IntoIterator<Item = (String, String)>,
) -> Self
pub fn with_vary_values( self, pairs: impl IntoIterator<Item = (String, String)>, ) -> Self
Mirror the public layer’s vary_on(...) declarations. The path’s
every variant is purged anyway; these pick the exact entry that is
also deleted at once.
Trait Implementations§
Source§impl PageCacheInvalidator for BoxedCacheInvalidator
impl PageCacheInvalidator for BoxedCacheInvalidator
Source§fn invalidate_url<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantSlug,
url_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn invalidate_url<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantSlug,
url_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
url_path on
the given tenant (slug and org id, as the page cache keys it).
Hosts pass the unprefixed page URL — the implementation appends
the configured URL prefix + host(s) before computing the cache key.Source§fn invalidate_subtree<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantSlug,
url_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn invalidate_subtree<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantSlug,
url_path: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
url_path /
(the page itself + every descendant). Called after a slug
rename, a move, or a subtree delete.Source§fn invalidate_urls<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantSlug,
url_paths: &'life2 [String],
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn invalidate_urls<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantSlug,
url_paths: &'life2 [String],
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self::invalidate_url — preserving the
per-URL behavior — but backends with a bulk-purge API
(Cloudflare files, Azure CDN contentPaths) should override
this to issue a single request instead of N. The purge fan-out
in crate::task_queue::purge_urls calls this so a batch
backend collapses a multi-URL save into one round-trip.Auto Trait Implementations§
impl !RefUnwindSafe for BoxedCacheInvalidator
impl !UnwindSafe for BoxedCacheInvalidator
impl Forget for BoxedCacheInvalidator
impl Freeze for BoxedCacheInvalidator
impl Send for BoxedCacheInvalidator
impl Sync for BoxedCacheInvalidator
impl Unpin for BoxedCacheInvalidator
impl UnsafeUnpin for BoxedCacheInvalidator
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> 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> ⓘ
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> ⓘ
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