Skip to content

Commit b11b135

Browse files
committed
Fix pkgdown and add one more example in cache_dataset
1 parent ab362f7 commit b11b135

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

R/cache.R

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#' - `"none"`: do not use the cache. This is the default for datasets that are versioned with `":draft"`, `":latest"`, and `":latest-published"`.
99
#' - `"session"`: cache API requests for the duration of the *R* session. This is the default for API calls that do not involve file or dataset retrieval.
1010
#' - `"disk": use a permanent disk cache. This is the default for files and explicitly versioned datasets.
11-
#'
11+
#'
1212
#' @template version
1313
#' @details
1414
#' `cache_dataset()` determines whether a dataset or file should be cached based on the version specification.
@@ -18,6 +18,18 @@
1818
#' @examples
1919
#' cache_dataset(":latest") # "none"
2020
#' cache_dataset("1.2") # "disk"
21+
#'
22+
#' \dontrun{
23+
#' # specifying the version will by default store a cache. Add `use_cache = "none"` to turn off
24+
#' df_tab <-
25+
#' get_dataframe_by_name(
26+
#' filename = "roster-bulls-1996.tab",
27+
#' dataset = "doi:10.70122/FK2/HXJVJU",
28+
#' server = "demo.dataverse.org",
29+
#' version = "3"
30+
#' )
31+
#' }
32+
#'
2133
#' @export
2234
cache_dataset <- function(version) {
2335
assert_string(version)
@@ -77,7 +89,7 @@ cache_info <- function() {
7789
#' @export
7890
cache_reset <- function() {
7991
cache_path <- cache_path()
80-
if (dir.exists(cache_path))
92+
if (dir.exists(cache_path))
8193
cache_disk(cache_path)$reset()
8294
invisible(cache_path)
8395
}

_pkgdown.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ reference:
4040
- '`get_file_metadata`'
4141
- '`get_user_key`'
4242
- '`get_url`'
43+
- '`cache_dataset`'
4344

4445
- title: "Create, Add, & Publish"
4546
contents:

man/cache.Rd

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)