Skip to content

Commit

Permalink
Merge pull request #403 from renkun-ken/styler-caching-readme
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
randy3k authored Mar 31, 2021
2 parents 150286d + 79f71ac commit ef43dde
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,5 @@ To further customize the formatting style, please refer to [Customizing styler](

With [`styler`](https://github.com/r-lib/styler) v1.3, the formatting of top-level expressions
can be cached by [`R.cache`](https://github.com/HenrikBengtsson/R.cache), which significantly improves the formatting performance by skipping the expressions that are known in cache to be already formatted. By default, the cache only works within the current session.
To make it work across sessions, user must run the following command to perform a one-time authorization to create a permanent directory in user home in an *interactive* R session:

```r
R.cache::getCachePath()
```

The first time the command is run, it will ask user whether to create a permanent cache directory. Type `Y` and enter, the cache directory will be created, and then all cache operations will be done across sessions so that formatted expressions could be remembered globally.

To check if a permanent directory is used or not, run the following command:

```r
styler::cache_info()
```
To make it work across sessions, set the R option `R.cache.rootPath` or environment variable `R_CACHE_ROOTPATH` to an existent path. For more details, see [styler caching](https://styler.r-lib.org/reference/caching.html).

0 comments on commit ef43dde

Please sign in to comment.