pub trait PageCacheInvalidator:
Send
+ Sync
+ 'static {
// Required method
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;
// Provided methods
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_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 { ... }
}Expand description
Hook called by admin handlers after a page-content mutation.
Implementations should fan out to whatever cache backend the
public router uses (in-memory CachePageLayer, Cloudflare,
Varnish, …) and drop the keys identified by the URL list.
Failures are intentionally swallowed by the handler (cache invalidation is best-effort; a stale render is worse than a failed save). Implementations should log internally.
Required Methods§
Sourcefn 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,
Drop the cache entry for the public render of 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.
Provided Methods§
Sourcefn 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,
Drop every cache entry whose URL starts with url_path /
(the page itself + every descendant). Called after a slug
rename, a move, or a subtree delete.
Sourcefn 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,
Drop the cache entries for many page URLs at once. The
default loops over 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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".