Documentation
¶
Overview ¶
Package forgecache provides a persistent cache for CI check-run results from code hosting forges (GitHub, GitLab, etc.). Only terminal results (all checks completed) are stored. The cache is backed by a single JSON file and is safe for concurrent use.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a thread-safe persistent store of terminal CI results keyed by "owner/repo/sha". Pending states are never cached. The cache also tracks which (taskID, sha) pairs have already been notified to avoid duplicate messages to agents. Both maps are pruned on load: entries older than maxAge are discarded.
func Open ¶
Open loads or creates a Cache backed by path. If path is empty, the cache operates in-memory only (no persistence). Returns a functional empty cache if the file does not exist or cannot be parsed. Malformed files are logged and discarded in full, including notification records; filesystem errors other than missing files are returned.
func (*Cache) Get ¶
Get returns the cached Result for (owner, repo, sha), or (Result{}, false) on a cache miss.
func (*Cache) IsNotified ¶
IsNotified reports whether a CI result has already been sent to the agent for the given task and SHA.
func (*Cache) MarkNotified ¶
MarkNotified records that a CI result has been sent to the agent for the given task and SHA, and persists to disk.