struct LLM::Cache::Stats

Overview

#orphans/#orphan_bytes are tracked apart from #entries/#bytes so #entries keeps counting usable cached responses while the reported footprint can still account for every byte the cache occupies. Stranded temp files also stay out of #oldest/#newest, which describe the age of the usable cache.

Defined in:

llm/cache.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(entries : Int32, bytes : Int64, oldest : Time | Nil, newest : Time | Nil, orphans : Int32 = 0, orphan_bytes : Int64 = 0) #

[View source]

Instance Method Detail

def bytes : Int64 #

def clone #

[View source]
def copy_with(entries _entries = @entries, bytes _bytes = @bytes, oldest _oldest = @oldest, newest _newest = @newest, orphans _orphans = @orphans, orphan_bytes _orphan_bytes = @orphan_bytes) #

[View source]
def entries : Int32 #

def newest : Time | Nil #

def oldest : Time | Nil #

def orphan_bytes : Int64 #

def orphans : Int32 #