cache

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 3 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] struct {
	// contains filtered or unexported fields
}

func New

func New[K comparable, V any](name string, size int, expiration time.Duration) *Cache[K, V]

New returns a new ARC cache with the given size and expiration, with a custom key and value type.

func (*Cache[K, V]) Get

func (c *Cache[K, V]) Get(key K) (val V)

Get returns the value for the given key, if it exists. Otherwise, it returns the default value of the value type.

func (*Cache[K, V]) Set

func (c *Cache[K, V]) Set(key K, val V)

Set sets the value for the given key.

Jump to

Keyboard shortcuts

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