ghidcache

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package ghidcache caches GitHub identity reads - `gh auth status` and `gh api user` - that re-resolve on every coily invocation but are stable

Index

Constants

View Source
const TTL = 1 * time.Hour

TTL is the freshness window for cached identity responses. 1h matches stscache and sits at the high end of "stable for hours" - a token

Variables

This section is empty.

Functions

func APIUser

func APIUser(fetch func() ([]byte, error)) ([]byte, error)

APIUser returns the JSON body of `gh api user`, served from cache if a fresh entry exists for the active GH_HOST + token. On miss it invokes

func AuthStatus

func AuthStatus(fetch func() ([]byte, error)) ([]byte, error)

AuthStatus returns the captured output of `gh auth status` (stderr, since gh writes the human-readable host/scope readout there).

func Invalidate

func Invalidate() error

Invalidate drops every cached identity entry under both subdirs. Callers that just rotated a token or switched GH_HOST can use this to

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL