# NOT RUN {
library(raster)
# make a cache repository
a <- Cache(rnorm, 1)
r <- raster(extent(0,10,0,10), vals = 1:100)
# write to disk manually -- will be in tempdir()
r <- writeRaster(r, file = tempfile())
# copy it to the cache repository
r <- .prepareFileBackedRaster(r, tempdir())
r # now in "rasters" subfolder of tempdir()
# }
Run the code above in your browser using DataLab