class

Crinit::CacheStore

Inherits Reference < Object

Manages content-addressed local caching for remote assets based on SHA-256 digests.

Constructors

from_config(config : Config) : CacheStore
Source
new(custom_dir : Path | Nil = nil)
Source

Class methods

digest(data : Bytes | String) : String

Computes SHA-256 hex digest for binary or string data.

Source

Instance methods

cache_dir
Source
cache_file(sha256 : String) : Path
Source
get(sha256 : String) : Path | Nil

Retrieves the path to the cached asset, or nil if absent or corrupted.

Source
has?(sha256 : String) : Bool

Checks whether an asset with the given SHA-256 is present and uncorrupted in the cache.

Source
store(sha256 : String, data : Bytes | String) : Path

Atomically stores content in cache indexed by SHA-256 digest.

Source