cache

package
v0.0.0-...-4f10b81 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 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 MemoizeCache

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

func NewMemoizeCache

func NewMemoizeCache[K comparable, V any](defaultTTL time.Duration, errorTTL time.Duration) *MemoizeCache[K, V]

func (*MemoizeCache[K, V]) Memoize

func (c *MemoizeCache[K, V]) Memoize(key K, f func() V) V

func (*MemoizeCache[K, V]) MemoizeCanErr

func (c *MemoizeCache[K, V]) MemoizeCanErr(key K, f func() (V, error)) (V, error)

func (*MemoizeCache[K, V]) MemoizeCanErrWithTTL

func (c *MemoizeCache[K, V]) MemoizeCanErrWithTTL(key K, ttl time.Duration, errorTTL time.Duration, f func() (V, error)) (V, error)

func (*MemoizeCache[K, V]) MemoizeWithTTL

func (c *MemoizeCache[K, V]) MemoizeWithTTL(key K, ttl time.Duration, f func() V) V

type RWMutexCache

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

func NewRWMutexCache

func NewRWMutexCache[K comparable, V any]() *RWMutexCache[K, V]

func (*RWMutexCache[K, V]) Delete

func (c *RWMutexCache[K, V]) Delete(key K) (V, bool)

func (*RWMutexCache[K, V]) Get

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

func (*RWMutexCache[K, V]) Put

func (c *RWMutexCache[K, V]) Put(key K, value V) (V, bool)

type RWMutexTTLCache

type RWMutexTTLCache[K comparable, V any] struct {
	DefaultTTL time.Duration
	// contains filtered or unexported fields
}

func NewRWMutexTTLCache

func NewRWMutexTTLCache[K comparable, V any](defaultTTL time.Duration) *RWMutexTTLCache[K, V]

func (*RWMutexTTLCache[K, V]) Delete

func (c *RWMutexTTLCache[K, V]) Delete(key K) (V, bool)

func (*RWMutexTTLCache[K, V]) Get

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

func (*RWMutexTTLCache[K, V]) Put

func (c *RWMutexTTLCache[K, V]) Put(key K, value V) (V, bool)

func (*RWMutexTTLCache[K, V]) PutWithTTL

func (c *RWMutexTTLCache[K, V]) PutWithTTL(key K, value V, ttl time.Duration) (V, bool)

Jump to

Keyboard shortcuts

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