cache

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
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

func NewBranchCache() *sturdyc.Client[[]models.Branch]

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

func NewTerminalJobsCache() *sturdyc.Client[bool]

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 JobTrace added in v0.6.0

type JobTrace struct {
	Content   string
	Truncated bool
}

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

func (m *Manager) GetSupportedEndpoints() []string

GetSupportedEndpoints returns a list of supported cache endpoints.

func (*Manager) InvalidateCache

func (m *Manager) InvalidateCache(endpoint string) error

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)

Jump to

Keyboard shortcuts

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