ttlru

package
v0.0.0-...-160b857 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2018 License: MIT Imports: 4 Imported by: 4

Documentation

Overview

Package ttlru LRU with TTL, implemented with goroutine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LruWithTTL

type LruWithTTL struct {
	*hlru.Cache
	// contains filtered or unexported fields
}

LruWithTTL lru with ttl

func NewTTL

func NewTTL(size int) (*LruWithTTL, error)

NewTTL creates an LRU of the given size

func NewTTLWithEvict

func NewTTLWithEvict(size int, onEvicted func(key interface{}, value interface{})) (*LruWithTTL, error)

NewTTLWithEvict creates an LRU of the given size and a evict callback function

func (*LruWithTTL) AddWithTTL

func (lru *LruWithTTL) AddWithTTL(key, value interface{}, ttl time.Duration) bool

AddWithTTL add an key:val with TTL

Jump to

Keyboard shortcuts

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