cached_call: Return the output of a function using a cache

Description Usage Arguments Value Examples

View source: R/cache.R

Description

Check cache for the cached output of fun for the arguments .... If a cache entry is found, return it. Otherwise call fun with arguments ... (and cache if cache is a parameter of fun), cache the result and then return it.

Usage

1
cached_call(fun, ..., cache = NULL)

Arguments

fun

function to call

...

arguments to fun (excluding cache). Both named and positional arguments are permitted.

cache

a Cache object

Value

The output of fun

Examples

1
2
3
4
cache <- create_cache()

result <- cached_call(mean, x=1:10, cache=cache)
result2 <- cached_call(mean, 1:10, cache=cache)

mattdneal/cacheMan documentation built on May 21, 2019, 12:58 p.m.