aboutsummaryrefslogtreecommitdiff
path: root/content/canory/messages/cache.md
blob: 9a57cedf2ea64b556efd475e971d0acb8648ea1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
+++
date    = "2022-02-27T20:18:43+00:00"
lastmod = "2022-02-27T20:18:43+00:00"
tags    = [ "docs" ]
+++

Resource abuse is not good --- cache responsibly. In the `hugo` configuration
file (config.yaml, config.json, config.toml) set the cache expiry time. The
default is `12h` (12 hours) for remote fetches and `-1` (forever) for assets,
images, and modules. The time scales are seconds (`s`), minutes (`m`), and hours
(`h`). Turn off a cache by setting a max age of `0`.

```yaml {options="hl_lines=9-17",caption="Caching Options"}
---
caches:
  assets:
    dir: :resourceDir/_gen
    maxAge: -1
  images:
    dir: :resourceDir/_gen
    maxAge: -1
  getcsv:
    dir: :resourceDir/caches
    maxAge: 12h
  getjson:
    dir: :resourceDir/caches
    maxAge: 12h
  getresource:
    dir: :resourceDir/caches
    maxAge: 12h
  modules:
    dir: :resourceDir/caches
    maxAge: -1
```