class

AptLarder::Admin::Client

Inherits Reference < Object

HTTP client for the apt-larder admin REST API.

Reads the admin host, port, and Bearer token from AdminConfig. All methods raise Admin::Error on non-2xx responses or network failures.

Constructors

new(config : AdminConfig, timeout : Time::Span | Nil = nil)

timeout, when given, bounds both the connect and the read phase of every request. Left nil (the interactive CLI subcommands), requests wait as long as the operating system lets them.

Source

Instance methods

cache_flush

Flushes the entire cache and returns {"deleted" => N}.

Source
cache_invalidate(key : String) : Nil

Invalidates a single entry identified by key (plain, not URL-encoded). Returns nil on 204, raises on 404 or other errors.

Source
cache_list(prefix : String = "", page : Int32 = 1, per_page : Int32 = 50) : JSON::Any

Returns a paginated list of cache entries.

Source
evict(max_age_days : Int32 | Nil = nil) : JSON::Any

Runs eviction with an optional max_age_days override. Returns {"deleted" => N, "freed_bytes" => N}.

Source
health

Returns {"status" => "ok", "version" => "..."}.

Source
stats

Returns cumulative counters: hits, misses, revalidations, errors, bytes.

Source