Documentation
¶
Index ¶
- Constants
- func NewBranchCache() *sturdyc.Client[[]models.Branch]
- func NewOrganizationCache() *sturdyc.Client[[]models.Organization]
- func NewPipelineCache() *sturdyc.Client[models.PipelinesResponse]
- func NewPipelineJobsCache() *sturdyc.Client[[]models.PipelineJob]
- func NewPullRequestCache() *sturdyc.Client[models.PullRequestsResponse]
- func NewRepositoryCache() *sturdyc.Client[[]models.Repository]
- func NewTerminalJobsCache() *sturdyc.Client[bool]
- type JobTrace
- type Manager
- type TerminalAwareCache
Constants ¶
const MaxCacheableTraceBytes = 512 * 1024
MaxCacheableTraceBytes caps which traces are cached; larger or truncated traces bypass the cache.
Variables ¶
This section is empty.
Functions ¶
func NewBranchCache ¶
NewBranchCache creates a sturdyc cache client for branch lists with early refreshes enabled.
func NewOrganizationCache ¶
func NewOrganizationCache() *sturdyc.Client[[]models.Organization]
newOrganizationCache creates a sturdyc cache client for organization lists with early refreshes enabled.
func NewPipelineCache ¶ added in v0.3.0
func NewPipelineCache() *sturdyc.Client[models.PipelinesResponse]
NewPipelineCache creates a sturdyc cache client for pipeline lists with early refreshes enabled. Uses a shorter TTL (1 minute) than pull requests (2 min) due to pipeline status volatility.
func NewPipelineJobsCache ¶ added in v0.6.0
func NewPipelineJobsCache() *sturdyc.Client[[]models.PipelineJob]
func NewPullRequestCache ¶ added in v0.2.0
func NewPullRequestCache() *sturdyc.Client[models.PullRequestsResponse]
NewPullRequestCache creates a sturdyc cache client for pull request lists with early refreshes enabled.
func NewRepositoryCache ¶
func NewRepositoryCache() *sturdyc.Client[[]models.Repository]
newRepositoryCache creates a sturdyc cache client for repository lists with early refreshes enabled. Maximum number of entries in the cache. Exceeding this number triggers eviction.
func NewTerminalJobsCache ¶ added in v0.6.0
NewTerminalJobsCache records job IDs known terminal, so GetJobTrace (which gets only a job ID, no status) can decide whether a trace is immutable and long-cacheable.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides centralized cache management for all cache instances.
func NewManager ¶
func NewManager( repositoryCache *sturdyc.Client[[]models.Repository], organizationCache *sturdyc.Client[[]models.Organization], branchCache *sturdyc.Client[[]models.Branch], pullRequestCache *sturdyc.Client[models.PullRequestsResponse], pipelineCache *sturdyc.Client[models.PipelinesResponse], pipelineJobsCache *sturdyc.Client[[]models.PipelineJob], pipelineJobTrace *TerminalAwareCache[JobTrace], ) *Manager
NewManager creates a new cache manager with all cache instances.
func (*Manager) GetSupportedEndpoints ¶
GetSupportedEndpoints returns a list of supported cache endpoints.
func (*Manager) InvalidateCache ¶
InvalidateCache invalidates the specified cache type.
type TerminalAwareCache ¶ added in v0.6.0
type TerminalAwareCache[T any] struct { // contains filtered or unexported fields }
TerminalAwareCache splits caching into a short-TTL live tier and a long-TTL done tier; Get checks done first, so a finished object is never shadowed by a stale live entry. It uses Get/Set (no in-flight de-duplication), so Invalidate is best-effort (scan then delete).
func NewPipelineJobTraceCache ¶ added in v0.6.0
func NewPipelineJobTraceCache() *TerminalAwareCache[JobTrace]
func NewTerminalAwareCache ¶ added in v0.6.0
func NewTerminalAwareCache[T any](live, done *sturdyc.Client[T]) *TerminalAwareCache[T]
func (*TerminalAwareCache[T]) Get ¶ added in v0.6.0
func (c *TerminalAwareCache[T]) Get(key string) (T, bool)
func (*TerminalAwareCache[T]) Invalidate ¶ added in v0.6.0
func (c *TerminalAwareCache[T]) Invalidate()
func (*TerminalAwareCache[T]) Set ¶ added in v0.6.0
func (c *TerminalAwareCache[T]) Set(key string, value T, terminal bool)