mem_cache

package
v3.9.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemCache

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

MemCache is a simple LRU cache that stores values in memory. It is safe for concurrent use.

func NewMemCache

func NewMemCache(size int, cleanerInterval time.Duration) *MemCache

NewMemCache initializes a MemCache. The minimum size is 1024. cleanerInterval specifies the interval that MemCache scans and discards expired values. If cleanerInterval <= 0, a default interval will be used.

func (*MemCache) Close

func (c *MemCache) Close() error

Close closes the cache and its cleaner.

func (*MemCache) Get

func (c *MemCache) Get(key string) (v []byte, storedTime, expirationTime time.Time)

func (*MemCache) Len

func (c *MemCache) Len() int

func (*MemCache) Store

func (c *MemCache) Store(key string, v []byte, storedTime, expirationTime time.Time)

Jump to

Keyboard shortcuts

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