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

Description Usage Arguments See Also Examples

View source: R/memoise.R

Description

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

Usage

1
forget(f)

Arguments

f

memoised function

See Also

memoise, is.memoised, drop_cache

Examples

1
2
3
4
5
6
memX <- memoise(function() { Sys.sleep(1); runif(1) })
# The forget() function
system.time(print(memX()))
system.time(print(memX()))
forget(memX)
system.time(print(memX()))

Example output

[1] 0.9182204
   user  system elapsed 
  0.002   0.000   1.007 
[1] 0.9182204
   user  system elapsed 
  0.057   0.000   0.058 
[1] TRUE
[1] 0.7468742
   user  system elapsed 
  0.004   0.000   1.010 

memoise documentation built on Nov. 26, 2021, 5:33 p.m.