cache

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Eviction

func Eviction(c *cache, interval time.Duration, stop chan bool)

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

This trick ensures that the eviction goroutine (which--granted it was enabled--is running DeleteExpired on c forever) does not keep the returned C object from being garbage collected. When it is garbage collected, the finalizer stops the eviction goroutine, after which c can be collected. Please refer to https://github.com/patrickmn/go-cache

func New

func New(expireDuration time.Duration, evictionInterval time.Duration) *Cache

func (Cache) Get

func (c Cache) Get(key string) (value any, valid bool)

func (Cache) Set

func (c Cache) Set(k string, x any)

Jump to

Keyboard shortcuts

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