simplemsglru

package
v0.0.0-...-19bb427 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EvictCallback

type EvictCallback func(s *[]dns.RR)

type LRU

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

func NewLRU

func NewLRU(size int, onEvict EvictCallback) (*LRU, error)

func (*LRU) Add

func (c *LRU) Add(s []dns.RR, rrtype uint16) bool

Add adds a value to the cache. Returns true if an eviction occurred.

func (*LRU) Contains

func (c *LRU) Contains(key interface{}) (ok bool)

Check if a key is in the cache, without updating the recent-ness or deleting it for being stale.

func (*LRU) Get

func (c *LRU) Get(name string, rtype uint16) ([]dns.RR, *time.Time, error)

Get looks up a key's value from the cache.

func (*LRU) Keys

func (c *LRU) Keys() []interface{}

Keys returns a slice of the keys in the cache, from oldest to newest.

func (*LRU) Len

func (c *LRU) Len() int

Len returns the number of items in the cache.

func (*LRU) Purge

func (c *LRU) Purge()

Purge is used to completely clear the cache

func (*LRU) Remove

func (c *LRU) Remove(name string, rtype uint16) error

func (*LRU) RemoveOldest

func (c *LRU) RemoveOldest()

RemoveOldest removes the oldest item from the cache.

type Record

type Record struct {
	Time time.Time
	// contains filtered or unexported fields
}

type Records

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

Jump to

Keyboard shortcuts

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