lru

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: MIT Imports: 4 Imported by: 2

README

lru

Go asynchronous LRU cache

Documentation

Overview

Package lru implements asynchronous LRU cache

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache is a LRU cache

func NewCache

func NewCache(maxSize int) *Cache

NewCache creates an LRU cache with the specified size.

func (*Cache) Get

func (c *Cache) Get(key string, f func(key string) (interface{}, error), value interface{}) error

Get returns the cached value for the key, or waits until f returns a value.

func (*Cache) Reset

func (c *Cache) Reset() error

Reset resets cache contents.

Jump to

Keyboard shortcuts

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