listCaches: Show available caches.

Description Usage Arguments Value Examples

View source: R/listCaches.R

Description

Lists any cache files in the cache directory.

Usage

1
listCaches(cacheSubDir = "")

Arguments

cacheSubDir

Optional parameter to specify a subdirectory of the cache folder.

Value

character vector in which each element is the path to a file that represents an available cache (within getOption("RCACHE.DIR"))

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# choose location to store caches
cacheDir = tempdir()
cacheDir
setCacheDir(cacheDir)

# build some caches
simpleCache("normSample", { rnorm(5e3, 0,1) }, recreate=TRUE, timer=TRUE)
simpleCache("normSample", { rnorm(5e3, 0,1) })
simpleCache("normSample", { rnorm(5e3, 0,1) }, reload=TRUE)

# storing a cache after-the-fact
normSample2 = rnorm(10, 0, 1)
storeCache("normSample2")

# what's available?
listCaches()

# load a cache
simpleCache("normSample")

# load multiples caches
loadCaches(c("normSample", "normSample2"), reload=TRUE)

Example output

[1] "/work/tmp/tmp/RtmpH8khhQ"
::Creating cache::	/work/tmp/tmp/RtmpH8khhQ/normSample.RData
<00h 00m 0.0s>::Object exists (in .GlobalEnv)::	normSample
::Loading cache::	/work/tmp/tmp/RtmpH8khhQ/normSample.RData
::Creating cache::	/work/tmp/tmp/RtmpH8khhQ/normSample2.RData
[1] "normSample.RData"  "normSample2.RData"
::Object exists (in .GlobalEnv)::	normSample
::Loading cache::	/work/tmp/tmp/RtmpH8khhQ/normSample.RData
::Loading cache::	/work/tmp/tmp/RtmpH8khhQ/normSample2.RData

simpleCache documentation built on April 17, 2021, 9:08 a.m.