cache

package
v0.0.0-...-8a2913d Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2018 License: BSD-3-Clause, BSD-3-Clause Imports: 7 Imported by: 1

README

This is a goinstall-able mirror of modified code already published at:
http://git.nic.cz/redmine/projects/godns/repository/show/cache

Online godoc documentation for this package (should be) available at:
http://gopkgdoc.appspot.com/pkg/github.com/cznic/dns/cache

Documentation

Overview

Package cache supports caching of DNS resource records.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Secs0

func Secs0() int64

Secs0 returns the app start time in epoch seconds.

Types

type Cache

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

Cache is a cache holding DNS RRs. Cache is organized as a dns.Tree. Cache handles RR TTLs, expired RRs are removed as encountered. Cache is safe for concurrent access.

func New

func New() *Cache

New returns a newly created Cache.

func (*Cache) Add

func (c *Cache) Add(rrs ...rr.RRs)

Add will put or append RRs r into the cache owned by their rr.RR.Name. RRs TTLs are interpreted as being relative to current time.

func (*Cache) Enum

func (c *Cache) Enum(root string, handler func([]string, rr.Bytes) bool)

Enum will enumerate Cache. Writers are blocked until Enum finishes.

func (*Cache) Get

func (c *Cache) Get(name string) (rrs rr.RRs, hit bool)

Get will return rrs and true if non expired cached RRs owned by name are present in the cache. If Get encounters expired RRs they are scheduled for removal and not returned.

Jump to

Keyboard shortcuts

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