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"))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.
See also
Other configuration:
cache_stats(),
configure_cache(),
dsp_configure(),
dsprrr_sitrep(),
get_default_chat(),
is_reasoning_model(),
with_lm()
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()
} # }