Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document HTTP cache config #2593

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions content/en/getting-started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,52 @@
[static-files]: /content-management/static-files/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pandoc, pdc



## Configure HTTP cache

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resources.ByType


{{< new-in 0.127.0 >}}

Note that this configuration is currently only relevant when using the [resources.GetRemote] function.

The caching in Hugo is layered:

```goat {.w-40}
.-----------.
| dynacache |
'-----+-----'
|
v
.----------.
| HTTP cache |
'-----+----'
|
v
.----------.
| file cache |
'-----+----'
```

Dynacache

Check warning on line 879 in content/en/getting-started/configuration.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (Dynacache)

Check warning on line 879 in content/en/getting-started/configuration.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (Dynacache)
: A in memory LRU cache that gets evicted on changes, [Cache Buster](#configure-cache-busters) matches and in low memory situations.

HTTP Cache
: Enables HTTP cache behavior (RFC 9111) for remote resources. This works best for resources with properly set up HTTP cache headers. The HTTP cache uses the [file cache] to store and serve cached resources.

File Cache
: See [file cache].

The default HTTP cache disables everything:

{{< code-toggle config=HTTPCache />}}

caching
: Enabled RFC 9111 cache behavior _for_ a configured set of resources. Stale resources will be refreshed from the [file cache] even if their configured TTL isn't reached.

polling
: Enables polling _for_ a set of resources. Note that you can enable polling for resources even if HTTP caching is disabled. This setting is only used when in watch mode (e.g. `hugo server`). When a change resource is detected, that change triggers a rebuild of pages using that resource.

[resources.GetRemote]: /functions/resources/getremote/
[file cache]: #configure-file-caches

## Configure segments

{{< new-in 0.124.0 >}}
Expand Down Expand Up @@ -916,3 +962,4 @@
[kind]: /getting-started/glossary/#page-kind
[output format]: /getting-started/glossary/#output-format
[type]: /getting-started/glossary/#content-type

16 changes: 16 additions & 0 deletions data/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,20 @@ chroma:
- zig
Name: Zig
config:
HTTPCache:
cache:
for:
excludes:
- '**'
includes: null
polls:
- disable: true
for:
excludes: null
includes:
- '**'
high: 0s
low: 0s
archeTypeDir: archetypes
assetDir: assets
author: {}
Expand Down Expand Up @@ -1721,6 +1735,8 @@ config_helpers:
_merge: none
frontmatter:
_merge: none
httpcache:
_merge: none
imaging:
_merge: none
languages:
Expand Down