lru_cache: Construct a cache with least-recently-used policy.

View source: R/lru.R

lru_cacheR Documentation

Construct a cache with least-recently-used policy.

Description

Construct a cache with least-recently-used policy.

Usage

lru_cache(size = 10000)

Arguments

size

The maximum number of results to keep.

Value

A function f(key, value) which takes a string in the first parameter and a lazily evaluated value in the second. 'f' will use the string key to retrieve a value from the cache, or return the matching item from the cache, or force the second argument and return that, remembering the result on future calls.

When the number of entries in the cache exceeds size, the least recently accessed entries are removed.


memo documentation built on May 5, 2022, 9:05 a.m.