Lists any cache files in the cache directory.

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

# choose location to store caches cacheDir = tempdir() cacheDir
#> [1] "/var/folders/3f/0wj7rs2144l9zsgxd3jn5nxc0000gn/T//Rtmp20Pfxj"
setCacheDir(cacheDir) # build some caches simpleCache("normSample", { rnorm(5e3, 0,1) }, recreate=TRUE, timer=TRUE)
#> ::Creating cache:: /var/folders/3f/0wj7rs2144l9zsgxd3jn5nxc0000gn/T//Rtmp20Pfxj/normSample.RData
#> <00h 00m 0.0s>
simpleCache("normSample", { rnorm(5e3, 0,1) })
#> ::Loading cache:: /var/folders/3f/0wj7rs2144l9zsgxd3jn5nxc0000gn/T//Rtmp20Pfxj/normSample.RData
simpleCache("normSample", { rnorm(5e3, 0,1) }, reload=TRUE)
#> ::Loading cache:: /var/folders/3f/0wj7rs2144l9zsgxd3jn5nxc0000gn/T//Rtmp20Pfxj/normSample.RData
# storing a cache after-the-fact normSample2 = rnorm(10, 0, 1) storeCache("normSample2")
#> ::Object does not exist:: normSample2
#> NULL
# what's available? listCaches()
#> [1] "normSample.RData"
# load a cache simpleCache("normSample")
#> ::Loading cache:: /var/folders/3f/0wj7rs2144l9zsgxd3jn5nxc0000gn/T//Rtmp20Pfxj/normSample.RData
# load multiples caches loadCaches(c("normSample", "normSample2"), reload=TRUE)
#> ::Loading cache:: /var/folders/3f/0wj7rs2144l9zsgxd3jn5nxc0000gn/T//Rtmp20Pfxj/normSample.RData
#> ::Creating cache:: /var/folders/3f/0wj7rs2144l9zsgxd3jn5nxc0000gn/T//Rtmp20Pfxj/normSample2.RData
#> Error in doTryCatch(return(expr), name, parentenv, handler): ::Error:: If you do not provide an instruction argument, you must setglobal option RBUILD.DIR with setCacheBuildDir, or specify a buildDirparameter directly to simpleCache().