R Under development (unstable) (2025-05-01 r88184 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library("R.cache") R.cache v0.17.0 successfully loaded. See ?R.cache for help. > > ## Use an empty temporary file cache > setCacheRootPath(path=file.path(tempdir())) > > dirs <- c("tests", "readCacheHeader") > > for (compress in c(FALSE, TRUE)) { + pathname <- saveCache(1, key=list("readCacheHeader"), dirs=dirs, compress=compress) + + for (byName in c(FALSE, TRUE)) { + if (byName) { + hdr <- readCacheHeader(pathname) + } else { + con <- gzfile(pathname, open="rb") + hdr <- readCacheHeader(con) + close(con) + } + str(list(pathname=pathname, hdr=hdr)) + } + } List of 2 $ pathname: chr "D:\\temp\\2025_05_02_23_50_16_9901\\RtmpkBUEi9/tests/readCacheHeader/351327a91bf868eddc966826e7b8de3e.Rcache" $ hdr :List of 4 ..$ identifier: chr "Rcache v0.1.7 (R package R.cache by Henrik Bengtsson) " ..$ version : chr "0.1.7" ..$ comment : chr "" ..$ timestamp : POSIXct[1:1], format: "2025-05-02 23:55:34" List of 2 $ pathname: chr "D:\\temp\\2025_05_02_23_50_16_9901\\RtmpkBUEi9/tests/readCacheHeader/351327a91bf868eddc966826e7b8de3e.Rcache" $ hdr :List of 4 ..$ identifier: chr "Rcache v0.1.7 (R package R.cache by Henrik Bengtsson) " ..$ version : chr "0.1.7" ..$ comment : chr "" ..$ timestamp : POSIXct[1:1], format: "2025-05-02 23:55:34" List of 2 $ pathname: chr "D:\\temp\\2025_05_02_23_50_16_9901\\RtmpkBUEi9/tests/readCacheHeader/351327a91bf868eddc966826e7b8de3e.Rcache.gz" $ hdr :List of 4 ..$ identifier: chr "Rcache v0.1.7 (R package R.cache by Henrik Bengtsson) " ..$ version : chr "0.1.7" ..$ comment : chr "" ..$ timestamp : POSIXct[1:1], format: "2025-05-02 23:55:34" List of 2 $ pathname: chr "D:\\temp\\2025_05_02_23_50_16_9901\\RtmpkBUEi9/tests/readCacheHeader/351327a91bf868eddc966826e7b8de3e.Rcache.gz" $ hdr :List of 4 ..$ identifier: chr "Rcache v0.1.7 (R package R.cache by Henrik Bengtsson) " ..$ version : chr "0.1.7" ..$ comment : chr "" ..$ timestamp : POSIXct[1:1], format: "2025-05-02 23:55:34" > > ## Cleanup > clearCache(recursive=TRUE) > > proc.time() user system elapsed 0.26 0.06 2.21