module Noir::CLI::CacheCommand

Overview

noir cache <info|clear|purge>

Managed resource: the on-disk LLM response cache.

Defined in:

cli/commands/cache.cr

Constant Summary

ACTIONS = ["info", "clear", "purge"] of ::String
MAX_PURGE_DAYS = 36500

Upper bound on noir cache purge <days>. 100 years is well past any realistic cache retention horizon; the actual reason for the cap is Crystal's Time.utc - <days>.days arithmetic, which raises ArgumentError: Invalid time: seconds out of range for values that push the resulting Time past the supported range. 100 years stays comfortably inside the Time bounds.

Class Method Summary

Class Method Detail

def self.clear(io : IO = STDOUT) #

[View source]
def self.parse_argv(argv : Array(String)) : Parsed #

[View source]
def self.parse_days(arg : String | Nil) : Int32 | Nil #

Returns days when arg is a positive integer within the representable Time range, nil otherwise. Pulled out of .purge so the validation rule can be exercised without going through the die exit path.


[View source]
def self.print_help(io : IO = STDOUT) #

[View source]
def self.print_info(io : IO = STDOUT) #

[View source]
def self.purge(rest : Array(String), io : IO = STDOUT) #

[View source]
def self.run(argv : Array(String)) #

[View source]