Skip to contents

clear_cache() deletes cached model responses from memory, from disk or both, and resets the hit and miss counts reported by cache_stats().

Usage

clear_cache(which = c("all", "memory", "disk"))

Arguments

which

Which tier to clear: "all" (the default), "memory" or "disk".

Value

TRUE, invisibly. If a tier cannot be cleaned up, the cache is still detached and an error lists the tiers that failed.

Details

The disk tier is cleared only if it has been opened in this session, which happens at the first cached model call. In a fresh session, clear_cache() leaves the directory on disk alone; delete the directory shown by dsprrr_sitrep() to remove it.

Examples

clear_cache("memory")
cache_stats()
#> 
#> ── dsprrr Cache Statistics 
#> • Hit rate: 0%
#> • Hits: 0
#> • Misses: 0

if (FALSE) { # \dontrun{
# Delete every cached response, on disk too
clear_cache()
} # }