cache

package
v12.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 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

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 Remotes

type Remotes = Cache[gitdomain.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

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.

Jump to

Keyboard shortcuts

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