# NOT RUN {
mySim <- simInit(times=list(start=0.0, end=5.0),
params=list(.globals=list(stackName="landscape", burnStats = "testStats")),
modules=list("randomLandscapes", "fireSpread"),
paths=list(modulePath=system.file("sampleModules", package="SpaDES")))
if (require(archivist)) {
# Call cache function directly
archivist::createLocalRepo(paths(mySim)$cachePath)
system.time(outSim <- cache(paths(mySim)$cachePath,
spades, sim = copy(mySim), .plotInitialTime = NA, notOlderThan = Sys.time()))
system.time(outSim <- cache(paths(mySim)$cachePath,
spades, sim = copy(mySim), .plotInitialTime = NA))
# This functionality can be achieved within a spades call
# compare caching ... run once to create cache
system.time(outSim <- spades(copy(mySim), cache = TRUE, notOlderThan = Sys.time(),
.plotInitialTime = NA))
# compare... second time is fast
system.time(outSimCached <- spades(copy(mySim), cache = TRUE, .plotInitialTime = NA))
all.equal(outSim, outSimCached)
}
# }
# NOT RUN {
# }
# NOT RUN {
clearCache(mySim)
# }
# NOT RUN {
showCache(mySim)
# }
Run the code above in your browser using DataLab