Skip to contents

cache_stats() reports whether caching is on, how many requests were served from the cache (hits) or sent to the model (misses) since the cache was last cleared, and how many responses each tier holds.

Usage

cache_stats()

Value

A list of class dsprrr_cache_stats with enabled, hits, misses, hit_rate (hits as a share of all requests), and memory_entries and disk_entries once those tiers are in use. If the disk cache failed its privacy checks, also degraded = TRUE and degraded_reason. Printing it gives a short report.

Examples

stats <- cache_stats()
stats
#> 
#> ── dsprrr Cache Statistics 
#> • Hit rate: 0%
#> • Hits: 0
#> • Misses: 0
stats$hit_rate
#> [1] 0