Drops the cache of a memoised function for particular arguments.

drop_cache(f)

Arguments

f

Memoised function.

Value

A function, with the same arguments as f, that can be called to drop the cached results of f.

See also

Examples

mem_sum <- memoise(sum)
mem_sum(1, 2, 3)
#> [1] 6
mem_sum(2, 3, 4)
#> [1] 9
has_cache(mem_sum)(1, 2, 3) # TRUE
#> [1] TRUE
has_cache(mem_sum)(2, 3, 4) # TRUE
#> [1] TRUE
drop_cache(mem_sum)(1, 2, 3) # TRUE
#> [1] TRUE
has_cache(mem_sum)(1, 2, 3) # FALSE
#> [1] FALSE
has_cache(mem_sum)(2, 3, 4) # TRUE
#> [1] TRUE