biocCache.Rd
This implements one possible cache
function for use in getFileMetadata
and friends.
Caching is based on BiocFileCache with thread-safety enforced by filelock.
biocCache(cache, key, save, update = FALSE)
A BiocFileCache object.
See getFileMetadata
for details on the caching function.
Logical scalar indicating whether assets in the cache should be forcibly updated. Useful for resolving corrupted caches or incomplete downloads.
String containing a path to the cached resource inside cache
.
getFileMetadata
for more details on the caching function.
library(BiocFileCache)
#> Loading required package: dbplyr
tmp <- tempfile()
bfc <- BiocFileCache(tmp, ask=FALSE)
cache.fun <- function(key, save) biocCache(bfc, key, save)
# First query hits the cache:
getFile(example.id, example.url, cache = cache.fun)
#> [1] "/tmp/RtmpqT1SXc/file7341c314d15/734c948460_734c948460"
# Second query re-uses the cache:
getFile(example.id, example.url, cache = cache.fun)
#> [1] "/tmp/RtmpqT1SXc/file7341c314d15/734c948460_734c948460"