cache

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 2 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[K comparable, V any] interface {
	Read(k K) V
	Write(k K, v V) V
	Remove(k K)
	Size() int
}

type InMemoryCache

type InMemoryCache[K comparable, V any] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewInMemoryCache

func NewInMemoryCache[K comparable, V any]() *InMemoryCache[K, V]

func (*InMemoryCache[K, V]) FromMap

func (c *InMemoryCache[K, V]) FromMap(m map[K]V) MapCache[K, V]

func (*InMemoryCache[K, V]) Read

func (c *InMemoryCache[K, V]) Read(k K) V

func (*InMemoryCache[K, V]) Remove

func (c *InMemoryCache[K, V]) Remove(k K)

func (*InMemoryCache[K, V]) Size

func (c *InMemoryCache[K, V]) Size() int

func (*InMemoryCache[K, V]) ToMap

func (c *InMemoryCache[K, V]) ToMap() map[K]V

func (*InMemoryCache[K, V]) Write

func (c *InMemoryCache[K, V]) Write(k K, v V) V

type MapCache

type MapCache[K comparable, V any] interface {
	Cache[K, V]
	FromMap(m map[K]V) MapCache[K, V]
	ToMap() map[K]V
}

type NoSuchElementError

type NoSuchElementError[K any] struct {
	// contains filtered or unexported fields
}

func NewNoSuchElementError

func NewNoSuchElementError[K any](key K) *NoSuchElementError[K]

func (*NoSuchElementError[K]) Error

func (e *NoSuchElementError[K]) Error() string

Jump to

Keyboard shortcuts

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