Documentation ¶
Overview ¶
Package cache provides infrastructure to cache things in memory.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[T any] struct { // contains filtered or unexported fields }
Cache is a cache implementation for arbitrary data structures that ensures it is initialized. The zero value is an empty cache.
func (*Cache[T]) Initialized ¶
Initialized indicates if we have a current branch.
type LocalBranchWithPrevious ¶ added in v11.1.0
type LocalBranchWithPrevious = WithPrevious[domain.LocalBranchName]
LocalBranch is a cache for domain.LocalBranchName variables.
type RemoteBranch ¶
type RemoteBranch = Cache[domain.RemoteBranchName]
RemoteBranch is a cache for domain.RemoteBranchName variables.
type WithPrevious ¶ added in v11.1.0
type WithPrevious[T any] struct { // contains filtered or unexported fields }
WithPrevious is a cache implementation for arbitrary data structures that keeps track of the current and previous values. The zero value is an empty cache.
func (*WithPrevious[T]) Initialized ¶ added in v11.1.0
func (c *WithPrevious[T]) Initialized() bool
Initialized indicates if we have a current branch.
func (*WithPrevious[T]) Invalidate ¶ added in v11.1.0
func (c *WithPrevious[T]) Invalidate()
Invalidate removes the cached value.
func (*WithPrevious[T]) Previous ¶ added in v11.1.0
func (c *WithPrevious[T]) Previous() T
Previous provides the previous value.
func (*WithPrevious[T]) Set ¶ added in v11.1.0
func (c *WithPrevious[T]) Set(newValue T)
Set allows collaborators to signal when the current branch has changed.
func (*WithPrevious[T]) Value ¶ added in v11.1.0
func (c *WithPrevious[T]) Value() T
Value provides the current value.