cache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcquireMsg added in v1.0.0

func AcquireMsg() *dns.Msg

AcquireMsg returns an empty msg from pool

func ReleaseMsg added in v1.0.0

func ReleaseMsg(m *dns.Msg)

ReleaseMsg returns msg to pool

Types

type Cache

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

Cache type

func New

func New(cfg *config.Config) *Cache

New return cache

func (*Cache) GetN

func (c *Cache) GetN(key uint64, req *dns.Msg) error

GetN returns negative entry for a key

func (*Cache) GetP

func (c *Cache) GetP(key uint64, req *dns.Msg) (*dns.Msg, *rl.RateLimiter, error)

GetP returns positive entry for a key

func (*Cache) Name

func (c *Cache) Name() string

Name return middleware name

func (*Cache) ServeDNS

func (c *Cache) ServeDNS(ctx context.Context, dc *ctx.Context)

ServeDNS implements the Handle interface.

func (*Cache) Set

func (c *Cache) Set(key uint64, msg *dns.Msg)

Set adds a new element to the cache. If the element already exists it is overwritten.

type ResponseWriter

type ResponseWriter struct {
	ctx.ResponseWriter

	*Cache
}

ResponseWriter implement of ctx.ResponseWriter

func (*ResponseWriter) WriteMsg

func (w *ResponseWriter) WriteMsg(res *dns.Msg) error

WriteMsg implements the ctx.ResponseWriter interface

Jump to

Keyboard shortcuts

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