cache

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: MIT Imports: 5 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 interface {
	Put(key string, item interface{}, byteSize int) error
	Get(key string) (interface{}, bool)
	Stats() CacheStats
}

type CacheStats

type CacheStats struct {
	TimeToEviction []time.Duration
	ByteSize       int
	ItemCount      int
	AgeEvictCount  int
	SizeEvictCount int
	ReplaceCount   int
	StatDuration   time.Duration
}

type LruCache

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

func New

func New(maxSize int, maxAge time.Duration) *LruCache

func (*LruCache) Get

func (c *LruCache) Get(key string) (interface{}, bool)

func (*LruCache) Put

func (c *LruCache) Put(key string, item interface{}, byteSize int) error

func (*LruCache) Stats

func (c *LruCache) Stats() CacheStats

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳