cache

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLRUCache

func NewLRUCache(maxSize int64) *lruCache

Types

type Cache

type Cache interface {
	Get(key string) (Value, bool)
	AddWithExpiration(key string, value Value, expirationTime time.Time)
	Add(key string, value Value)
}

type MaxMemoryPolicy

type MaxMemoryPolicy int
const (
	VOLATILE_LRU    MaxMemoryPolicy = 1
	VOLATILE_RANDOM MaxMemoryPolicy = 2
	ALLKEYS_LRU     MaxMemoryPolicy = 3
	ALLKEYS_RANDOM  MaxMemoryPolicy = 4
)

type Value

type Value interface {
	Len() int // return data size
}

Jump to

Keyboard shortcuts

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