mtimesyncedcache

package
v2.40.2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache[K comparable, T any] struct {
	// contains filtered or unexported fields
}

func New

func New[K comparable, T any]() Cache[K, T]

func (*Cache[K, T]) Load

func (c *Cache[K, T]) Load(key K) (T, bool)

func (*Cache[K, T]) LoadOrStore

func (c *Cache[K, T]) LoadOrStore(key K, mtime time.Time, f func() (T, error)) (T, error)

func (*Cache[K, T]) Store

func (c *Cache[K, T]) Store(key K, mtime time.Time, value T) error

type Map

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

func (*Map[K, V]) Count

func (m *Map[K, V]) Count() int

func (*Map[K, V]) Delete

func (m *Map[K, V]) Delete(key K)

func (*Map[K, V]) Load

func (m *Map[K, V]) Load(key K) (value V, ok bool)

func (*Map[K, V]) LoadAndDelete

func (m *Map[K, V]) LoadAndDelete(key K) (value V, loaded bool)

func (*Map[K, V]) LoadOrStore

func (m *Map[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool)

func (*Map[K, V]) Range

func (m *Map[K, V]) Range(f func(key K, value V) bool)

func (*Map[K, V]) Store

func (m *Map[K, V]) Store(key K, value V)

Jump to

Keyboard shortcuts

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