cache

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2018 License: MIT Imports: 12 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
}

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(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