Skip to content

Commit e3e044b

Browse files
committed
rename config.full_page_caching to cache_invalidatable_responses
1 parent 37ea2b6 commit e3e044b

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/cdn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ pub(crate) fn queue_crate_invalidation(
401401
config: &Config,
402402
name: &str,
403403
) -> Result<()> {
404-
if !config.full_page_cache {
404+
if !config.cache_invalidatable_responses {
405405
info!("full page cache disabled, skipping queueing invalidation");
406406
return Ok(());
407407
}

src/config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub struct Config {
8080
// Activate full page caching.
8181
// When disabled, we still cache static assets.
8282
// This only affects pages that depend on invalidations to work.
83-
pub(crate) full_page_cache: bool,
83+
pub(crate) cache_invalidatable_responses: bool,
8484

8585
pub(crate) cdn_backend: CdnKind,
8686

@@ -179,7 +179,7 @@ impl Config {
179179
"CACHE_CONTROL_STALE_WHILE_REVALIDATE",
180180
)?,
181181

182-
full_page_cache: env("DOCSRS_FULL_PAGE_CACHE", true)?,
182+
cache_invalidatable_responses: env("DOCSRS_CACHE_INVALIDATEABLE_RESPONSES", true)?,
183183

184184
cdn_backend: env("DOCSRS_CDN_BACKEND", CdnKind::Dummy)?,
185185

src/utils/daemon.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ pub fn start_background_cdn_invalidator(context: &dyn Context) -> Result<(), Err
109109
return Ok(());
110110
}
111111

112-
if !config.full_page_cache {
112+
if !config.cache_invalidatable_responses {
113113
info!("full page cache disabled, skipping background cdn invalidation");
114114
return Ok(());
115115
}

src/web/cache.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl CachePolicy {
4848
CachePolicy::NoStoreMustRevalidate => Some(NO_STORE_MUST_REVALIDATE.clone()),
4949
CachePolicy::ForeverInCdnAndBrowser => Some(FOREVER_IN_CDN_AND_BROWSER.clone()),
5050
CachePolicy::ForeverInCdn => {
51-
if config.full_page_cache {
51+
if config.cache_invalidatable_responses {
5252
// A missing `max-age` or `s-maxage` in the Cache-Control header will lead to
5353
// CloudFront using the default TTL, while the browser not seeing any caching header.
5454
// This means we can have the CDN caching the documentation while just
@@ -60,7 +60,7 @@ impl CachePolicy {
6060
}
6161
}
6262
CachePolicy::ForeverInCdnAndStaleInBrowser => {
63-
if config.full_page_cache {
63+
if config.cache_invalidatable_responses {
6464
config
6565
.cache_control_stale_while_revalidate
6666
.map(|seconds| format!("stale-while-revalidate={seconds}").parse().unwrap())
@@ -161,7 +161,7 @@ mod tests {
161161
fn render_forever_in_cdn_disabled() {
162162
wrapper(|env| {
163163
env.override_config(|config| {
164-
config.full_page_cache = false;
164+
config.cache_invalidatable_responses = false;
165165
});
166166

167167
assert_eq!(
@@ -176,7 +176,7 @@ mod tests {
176176
fn render_forever_in_cdn_or_stale_disabled() {
177177
wrapper(|env| {
178178
env.override_config(|config| {
179-
config.full_page_cache = false;
179+
config.cache_invalidatable_responses = false;
180180
});
181181

182182
assert_eq!(

0 commit comments

Comments
 (0)