drop_cache
to
reset the cache only for particular arguments.R/memoise.R
forget.Rd
Forget past results.
Resets the cache of a memoised function. Use drop_cache
to
reset the cache only for particular arguments.
forget(f)
memoised function
memX <- memoise(function() { Sys.sleep(1); runif(1) })
# The forget() function
system.time(print(memX()))
#> [1] 0.3930557
#> user system elapsed
#> 0.001 0.000 1.002
system.time(print(memX()))
#> [1] 0.3930557
#> user system elapsed
#> 0.001 0.000 0.000
forget(memX)
#> [1] TRUE
system.time(print(memX()))
#> [1] 0.8615088
#> user system elapsed
#> 0.000 0.000 1.002