Forget past results. Resets the cache of a memoised function.

forget(f)

Arguments

f

memoised function

See also

Examples

memX <- memoise(function() { Sys.sleep(1); runif(1) }) # The forget() function system.time(print(memX()))
#> [1] 0.08075014
#> user system elapsed #> 0.001 0.000 1.016
#> [1] 0.08075014
#> user system elapsed #> 0 0 0
forget(memX)
#> [1] TRUE
#> [1] 0.834333
#> user system elapsed #> 0.001 0.000 1.003