Convenience function to cache to your own public or private Keybase folder

cache_kb_self(cache_subdir, private = TRUE, algo = "sha512")

Arguments

cache_subdir, private

subdirectory under either KB_HOME/private (if private is TRUE, the default) or KB_HOME/public if (private is FALSE). It will be created if it does not exist.

algo

The hashing algorithm used for the cache, see digest::digest() for available algorithms.

Details

This ultimately uses cache_fs2(), which means two additional functions are provided in slots in the returned list:

  • location() which will return the path to the cache directory

  • size() which will compute and return the size of the cache (in bytes)

Examples

if (tinytest::at_home()) {
kbc <- cache_kb_self(".cache")

kbc$location()

mrunif <- memoise::memoise(runif, cache = kbc)

mrunif(10) # First run, saves cache
mrunif(10) # Loads cache, results should be identical

kbc$keys()

kbc$size()

kbc$reset()

kbc$size()
}