@@ -23,9 +23,25 @@ cache_clear <- function(cache_name = NULL, ask = TRUE) {
23
23
# ' Remember the past to be quicker in the future
24
24
# '
25
25
# ' Caching makes styler faster on repeated styling and is shared across all APIs
26
- # ' (e.g. `style_text()` and Addin).
27
- # ' That means if you style code that already complies to a
28
- # ' style guide and you have previously styled that code, it will be quicker.
26
+ # ' (e.g. `style_text()` and Addin). That means if you style code that already
27
+ # ' complies to a style guide and you have previously styled that code, it will
28
+ # ' be quicker.
29
+ # '
30
+ # ' @section Configuring the cache:
31
+ # '
32
+ # ' To comply with the CRAN policy, \{styler\} will by default clean up cache files
33
+ # ' that are older than 6 days. This implies that you loose the benefit of the cache
34
+ # ' for the files not styled in the last 6 days.
35
+ # '
36
+ # ' If you want to avoid this, i.e., if you want the cache to last longer, you can use the
37
+ # ' R option `styler.cache_root` to opt for an indefinitely long-lived cache by setting it to
38
+ # ' `options(styler.cache_root = "styler-perm")`.
39
+ # '
40
+ # ' If you are happy with the cache being cleared after 6 days, you can confirm the default and
41
+ # ' silence this message by setting it instead to `options(styler.cache_root = "styler")`.
42
+ # '
43
+ # ' You can make this change in your `.Rprofile` using `usethis::edit_r_profile()`.
44
+ # '
29
45
# ' @section Manage the cache:
30
46
# ' See [cache_info()],[cache_activate()] or [cache_clear()] for utilities to
31
47
# ' manage the cache. You can deactivate it altogether with [cache_deactivate()].
@@ -47,6 +63,11 @@ cache_clear <- function(cache_name = NULL, ask = TRUE) {
47
63
# ' which is why it takes zero space on disk (the cache is a directory with
48
64
# ' empty files which have the hash of output code as name).
49
65
# '
66
+ # ' The cache literally takes zero space on your disk, only the inode, and you
67
+ # ' can always manually clean up with [cache_clear()] or just go to the
68
+ # ' directory where the cache lives (find it with [cache_info()]) and manually
69
+ # ' delete files.
70
+ # '
50
71
# ' @section Using a cache for styler in CI/CD:
51
72
# ' If you want to set up caching in a CI/CD pipeline, we suggest to set the
52
73
# ' `{R.cache}` root path to a directory for which you have the cache enabled.
0 commit comments