lru_cache: 'basic_cache' makes a cache that does not expire old entries....

View source: R/lru.R

permanent_cacheR Documentation

'basic_cache' makes a cache that does not expire old entries. It should be used in situations where you know the number of things to remember is bounded.

Description

'basic_cache' makes a cache that does not expire old entries. It should be used in situations where you know the number of things to remember is bounded.

Construct a cache with least-recently-used policy.

Usage

permanent_cache()

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.


crowding/memo documentation built on Jan. 4, 2024, 6:38 a.m.