lttlru

package
v0.0.0-...-39ae23d Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package lttlru LRU with TTL, implemented without 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

func (*LruWithTTL) GetWithTTL

func (lru *LruWithTTL) GetWithTTL(key interface{}) (interface{}, bool)

Jump to

Keyboard shortcuts

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