cache

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) InvalidateCache

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

InvalidateCache returns a *gferrors.InvalidParamError for parameter "endpoint" when endpoint is unknown. Clearing is best-effort: entries written during the scan can survive.

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