lru

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2020 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 Lru

type Lru struct {
	Head *LruNode //头部是最老数据
	Tail *LruNode //尾部是最新数据
	// contains filtered or unexported fields
}

func New

func New(options Options) *Lru

newLocalSessionUids ttl :seconds

func (*Lru) Add

func (l *Lru) Add(key string, value interface{})

func (*Lru) Delete

func (l *Lru) Delete(key string)

func (*Lru) Get

func (l *Lru) Get(key string) interface{}

func (*Lru) GetInt

func (l *Lru) GetInt(key string) int

func (*Lru) GetString

func (l *Lru) GetString(key string) string

type LruNode

type LruNode struct {
	Pre   *LruNode
	Next  *LruNode
	Key   string
	Value interface{}
	Ct    int64
	Ut    int64
}

type Options

type Options struct {
	Ttl             int //seconds
	MaxAge          int //seconds
	MaxLength       int
	CleanupInterval int //seconds
}

Jump to

Keyboard shortcuts

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