Documentation
¶
Overview ¶
Package ghcache caches GitHub REST `GET` responses keyed by method, path, body, and token fingerprint, with method-aware write-through
Index ¶
Constants ¶
const ( // TTL1Min covers fast-moving issue/PR/CI surfaces. Sized to absorb a // `watch -n 2` loop across ~10 repos (~10 calls/min, well under the TTL1Min = 1 * time.Minute // TTL10Min covers head-of-branch reads, ref/tree/content lookups, // and search. Slower turnover than issues; long enough to collapse TTL10Min = 10 * time.Minute // TTL1Hour covers repo-level metadata: the repo body, labels, // milestones, releases, tags, topics, languages, contributors, TTL1Hour = 1 * time.Hour // TTL25Hour covers the identity surface: user, org, teams. Picked // at 25 (not 24) hours so a daily cron always sees a miss across TTL25Hour = 25 * time.Hour )
Default TTLs by tier. Exported so callers and tests can reference the same constants the path-classifier uses internally.
Variables ¶
This section is empty.
Functions ¶
func GetJSON ¶
GetJSON fetches the response body for a `GET <path>` GitHub REST call, served from cache if a fresh entry exists. On miss it invokes fetch
func Invalidate ¶
func Invalidate(method, path string)
Invalidate drops cache entries that a `method <path>` write would affect. Idempotent and safe to call on paths that have no cached
func MaybeServe ¶
MaybeServe is the lookup-only half of the cache. Returns (cached bytes, true) on a fresh hit, (nil, false) on miss or unclassified
func MaybeServeMaxAge ¶
MaybeServeMaxAge is the per-call-freshness variant of MaybeServe. Returns (cached bytes, true) only when a cached entry exists AND its
Types ¶
This section is empty.