lru4

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 2 Imported by: 1

Documentation

Overview

Package lru4 ...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// MaxEntries is max
	MaxEntries int
	// contains filtered or unexported fields
}

Cache struct manage mem

func New

func New(maxEntries int) *Cache

New return lru4 cache obj

func (*Cache) Add

func (c *Cache) Add(key Key, val interface{})

Add set k,v

func (*Cache) FlushAll

func (c *Cache) FlushAll()

FlushAll remove all keys

func (*Cache) Get

func (c *Cache) Get(key Key) (val interface{}, hit bool)

Get search k,v

func (*Cache) Remove

func (c *Cache) Remove(key Key)

Remove clear k

func (*Cache) RemoveOldest

func (c *Cache) RemoveOldest()

RemoveOldest clear back ele

type Key

type Key interface{}

Key is search_key

Jump to

Keyboard shortcuts

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