cache_method {CellBench} | R Documentation

## Create a cached function for CellBench

### Description

Take a function and return a cached version. The arguments and results of a cached method is saved to disk and if the cached function is called again with the same arguments then the results will be retrieved from the cache rather than be recomputed.

### Usage

    cache_method(f, cache = getOption("CellBench.cache"))

### Arguments

`f` | the function to be cached
`cache` | the cache information (from memoise package)

### Details

(CAUTION) Because cached functions called with the same argument will always return the same output, pseudo-random methods will not return varying results over repeated runs as one might expect.

This function is a thin wrapper around `memoise`

### Value

function whose results are cached and is called identically to f

### See Also

`set_cellbench_cache_path`

### Examples

    # sets cache path to a temporary directory
    set_cellbench_cache_path(file.path(tempdir(), ".CellBenchCache"))
    f <- function(x) { x + 1 }
    cached_f <- cache_method(f)

[Package CellBench version 1.0.1 Index]