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 ¶
type LocalBranchWithPrevious = WithPrevious[gitdomain.LocalBranchName]
LocalBranch is a cache for gitdomain.LocalBranchName variables.
type RemoteBranch ¶
type RemoteBranch = Cache[gitdomain.RemoteBranchName]
RemoteBranch is a cache for gitdomain.RemoteBranchName variables.
type WithPrevious ¶
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 ¶
func (c *WithPrevious[T]) Initialized() bool
Initialized indicates if we have a current branch.
func (*WithPrevious[T]) Invalidate ¶
func (c *WithPrevious[T]) Invalidate()
Invalidate removes the cached value.
func (*WithPrevious[T]) Previous ¶
func (c *WithPrevious[T]) Previous() T
Previous provides the previous value.
func (*WithPrevious[T]) Set ¶
func (c *WithPrevious[T]) Set(newValue T)
Set allows collaborators to signal when the current branch has changed.
func (*WithPrevious[T]) Value ¶
func (c *WithPrevious[T]) Value() T
Value provides the current value.