drop_cache: Drops the cache of a memoised function for particular...

View source: R/memoise.R

drop_cacheR Documentation

Drops the cache of a memoised function for particular arguments.

Description

Drops the cache of a memoised function for particular arguments.

Usage

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

has_cache, memoise

Examples

mem_sum <- memoise(sum)
mem_sum(1, 2, 3)
mem_sum(2, 3, 4)
has_cache(mem_sum)(1, 2, 3) # TRUE
has_cache(mem_sum)(2, 3, 4) # TRUE
drop_cache(mem_sum)(1, 2, 3) # TRUE
has_cache(mem_sum)(1, 2, 3) # FALSE
has_cache(mem_sum)(2, 3, 4) # TRUE

hadley/memoise documentation built on Jan. 5, 2024, 10:35 a.m.