Forget past results. Resets the cache of a memoised function. Use drop_cache to reset the cache only for particular arguments.

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.003
system.time(print(memX()))
#> [1] 0.08075014
#> user system elapsed #> 0.001 0.000 0.000
forget(memX)
#> [1] TRUE
system.time(print(memX()))
#> [1] 0.834333
#> user system elapsed #> 0.000 0.000 1.047