cache

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

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
}

func New

func New() *Cache

New returns a new and initialized A dns cache.

func (*Cache) Add

func (c *Cache) Add(qname string, rr *dns.A)

Add an item to the cache only if item doesn't exist for a given key.

func (*Cache) Get

func (c *Cache) Get(qname string) ([]*dns.A, bool)

Get an item (list) from the cache, returning an item and a boolean indicating if the key has been found.

func (*Cache) GetRand

func (c *Cache) GetRand(qname string) (*dns.A, bool)

GetRand gets a randomized item (single item) from the cache, returning also a boolean indicating if the key has been found.

func (*Cache) Set

func (c *Cache) Set(qname string, rr *dns.A)

Set adds a single item to the cache, replacing all existing items.

Jump to

Keyboard shortcuts

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