Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCacheKey ¶
CreateCacheKey creates a cache key for a specific app configuration
Types ¶
type CacheStats ¶
CacheStats contains cache statistics
type CachedToken ¶
type CachedToken struct {
Token string // GitHub installation token (ghs_...)
ExpiresAt time.Time // When this token expires (55-min from creation)
CreatedAt time.Time // When this token was cached
}
CachedToken represents a cached GitHub App installation token with expiration information.
Installation tokens (not JWTs) are cached because: - JWT tokens are short-lived (~10min) and cheap to generate - Installation tokens require API calls to GitHub and have 1-hour validity - Caching reduces GitHub API load and improves performance
type TokenCache ¶
type TokenCache struct {
// contains filtered or unexported fields
}
TokenCache provides thread-safe caching of GitHub App installation tokens with TTL.
SECURITY NOTE: This cache stores installation tokens IN MEMORY ONLY. Tokens are NOT persisted to disk or encrypted storage. This design prioritizes security over convenience - tokens expire with process lifetime, reducing attack surface.
Installation tokens have 1-hour validity from GitHub and are cached for 55 minutes (5-minute safety buffer). This reduces API calls to GitHub by ~98% while ensuring tokens are never stale.
For detailed security analysis, see docs/TOKEN_CACHING.md
func (*TokenCache) Delete ¶
func (c *TokenCache) Delete(key string)
Delete removes a token from the cache
func (*TokenCache) Get ¶
func (c *TokenCache) Get(key string) (string, bool)
Get retrieves a token from the cache if it exists and is not expired
func (*TokenCache) GetStats ¶
func (c *TokenCache) GetStats() CacheStats
GetStats returns cache statistics