cache

package
v1.21.4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: Zlib Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache[M Key, O any, K Key, V any] struct {
	// contains filtered or unexported fields
}

func New

func New[M Key, O any, K Key, V any](useChild bool) *Cache[M, O, K, V]

func (*Cache[M, O, K, V]) Add

func (c *Cache[M, O, K, V]) Add(key M, v O) *Part[O, K, V]

func (*Cache[M, O, K, V]) Child

func (c *Cache[M, O, K, V]) Child(key M, child K) (O, V, bool)

func (*Cache[M, O, K, V]) ChildValues

func (c *Cache[M, O, K, V]) ChildValues(key M, where func(k K, v V) bool) (O, []V, bool)

func (*Cache[M, O, K, V]) Delete

func (c *Cache[M, O, K, V]) Delete(where func(key M, c *Part[O, K, V]) bool)

func (*Cache[M, O, K, V]) Foreach

func (c *Cache[M, O, K, V]) Foreach(each func(key M, c *Part[O, K, V]))

func (*Cache[M, O, K, V]) Get

func (c *Cache[M, O, K, V]) Get(key M) *Part[O, K, V]

func (*Cache[M, O, K, V]) Remove

func (c *Cache[M, O, K, V]) Remove(key M) *Part[O, K, V]

type Child

type Child[K Key, V any] struct {
	// contains filtered or unexported fields
}

func NewChild

func NewChild[K Key, V any]() *Child[K, V]

func (*Child[K, V]) Add

func (c *Child[K, V]) Add(key K, v V) V

Add return old value

func (*Child[K, V]) Delete

func (c *Child[K, V]) Delete(where func(v V) bool)

func (*Child[K, V]) Foreach

func (c *Child[K, V]) Foreach(each func(key K, c V))

func (*Child[K, V]) Get

func (c *Child[K, V]) Get(key K) (V, bool)

func (*Child[K, V]) Remove

func (c *Child[K, V]) Remove(key K) (V, bool)

func (*Child[K, V]) Values

func (c *Child[K, V]) Values(where func(k K, v V) bool) []V

type Key

type Key interface {
	~int | ~int16 | ~int32 | ~int64 | ~uint32 | uint16 | ~uint | ~string
}

type Part

type Part[O any, K Key, V any] struct {
	// contains filtered or unexported fields
}

func (*Part[O, K, V]) AddChild

func (c *Part[O, K, V]) AddChild(key K, v V) V

AddChild return old value

func (*Part[O, K, V]) ChildList

func (c *Part[O, K, V]) ChildList(where func(k K, v V) bool) []V

func (*Part[O, K, V]) DeleteChild

func (c *Part[O, K, V]) DeleteChild(where func(v V) bool)

func (*Part[O, K, V]) ForeachChild

func (c *Part[O, K, V]) ForeachChild(each func(key K, c V))

func (*Part[O, K, V]) Get

func (c *Part[O, K, V]) Get() O

func (*Part[O, K, V]) GetChild

func (c *Part[O, K, V]) GetChild(key K) (V, bool)

func (*Part[O, K, V]) RemoveChild

func (c *Part[O, K, V]) RemoveChild(key K) (V, bool)

func (*Part[O, K, V]) Set

func (c *Part[O, K, V]) Set(v O)

Jump to

Keyboard shortcuts

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