This commit is contained in:
Mateusz Gruszczyński committed 2026-11-19 16:23:30 +01:00
1 parent 38a23e2210
commit 45b1fc04c7
36 files changed
+9594 -7892

No files matched your search

+17 -2
View File
@@ -7,6 +7,7 @@ pub(super) enum CachePlan {
Enabled {
force_cache: bool,
ignore_cookie: bool,
vcl_cookie_lookup: bool,
},
}
@@ -24,9 +25,21 @@ impl CachePlan {
Self::Enabled {
force_cache,
ignore_cookie: !force_cache && settings.ignore_cookie_for_path(path),
vcl_cookie_lookup: false,
}
}
pub(super) fn with_vcl_cookie_lookup(mut self, allowed: bool) -> Self {
if let Self::Enabled { vcl_cookie_lookup, .. } = &mut self {
*vcl_cookie_lookup = allowed;
}
self
}
pub(super) fn vcl_cookie_lookup(self) -> bool {
matches!(self, Self::Enabled { vcl_cookie_lookup: true, .. })
}
pub(super) fn force_cache(self) -> bool {
matches!(
self,
@@ -61,8 +74,10 @@ impl CachePlan {
Self::Enabled {
force_cache: true, ..
} => crate::cache::forced_request_policy(method, headers, body_empty),
Self::Enabled { .. } => {
crate::cache::request_policy(method, headers, body_empty, path, has_query, settings)
Self::Enabled { vcl_cookie_lookup, .. } => {
crate::cache::request_policy_with_vcl_cookie(
method, headers, body_empty, path, has_query, settings, vcl_cookie_lookup,
)
}
}
}