@@ -23,15 +23,42 @@ cache_clear <- function(cache_name = NULL, ask = TRUE) {
2323
2424# ' Remember the past to be quicker in the future
2525# '
26+ # ' Caching makes styler faster on repeated styling. It does not cache input
27+ # ' but output code. 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.
29+ # ' Code is cached by expression and the cache is shared across all APIs.
30+ # '
31+ # ' @section Setup:
2632# ' styler by default uses caching. It may prompt you to install the R package
2733# ' `R.cache` the first time you want to use it. R.cache will also ask you to let
2834# ' it create a permanent cache on your file system that styler will use.
2935# ' This is needed if you want to cache across R sessions and not just within.
36+ # '
37+ # ' @section Non-interactive use:
38+ # ' Note that if you have never authorized `{R.cache}` to create the cache in a
39+ # ' permenent directory, it wil build the cache in a temporary directory. To
40+ # ' create a permenent cache, just open an interactive R session and type
41+ # ' `cache_info()`. You can see under `Location:` if a permanent directory is
42+ # ' used and if not, `{R.cache}` will ask you to create one.
43+ # '
44+ # ' @section Invalidation:
3045# ' The cache is specific to a version of styler by default, because different
3146# ' versions potentially format code differently. This means after upgrading
3247# ' styler or a style guide you use, the cache will be re-built.
48+ # '
49+ # ' @section Manage the cache:
3350# ' See [cache_info()],
34- # ' [cache_activate()], [cache_clear()] for utilities to manage the cache.
51+ # ' [cache_activate()], [cache_clear()] for utilities to manage the cache. Since
52+ # ' we leverage `{R.cache}` to manage the cache, you can also use any `{R.cache}`
53+ # ' functionality to manipulate it.
54+ # '
55+ # ' @section Using a cache for styler in CI/CD:
56+ # ' If you want to set up caching in a CI/CD pipeline, we suggest to set the
57+ # ' `{R.cache}` root path to a directory for which you have the cache enabled.
58+ # ' The former can be done with `R.cache::setCacheRootPath("/path/to/cache")`,
59+ # ' the latter can often be set in config files of CI/CD tools, e.g. see the
60+ # ' the [Travis documentation on caching](https://docs.travis-ci.com/user/caching).
61+ # '
3562# ' @name caching
3663NULL
3764
0 commit comments