cache

package
v11.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: MIT Imports: 2 Imported by: 0

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 Bool

type Bool = Cache[bool]

Bool is a cache for bool variables.

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

func (c *Cache[T]) Initialized() bool

Initialized indicates if we have a current branch.

func (*Cache[T]) Invalidate

func (c *Cache[T]) Invalidate()

Invalidate removes the cached value.

func (*Cache[T]) Set

func (c *Cache[T]) Set(newValue T)

Set allows collaborators to signal when the current branch has changed.

func (*Cache[T]) Value

func (c *Cache[T]) Value() T

Value provides the current value.

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 Remotes

type Remotes = Cache[domain.Remotes]

Remotes is a cache for domain.Remotes variables.

type String

type String = Cache[string]

String is a cache for string variables.

type Strings

type Strings = Cache[[]string]

Strings is a cache for string 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.

Jump to

Keyboard shortcuts

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