sdns: github.com/semihalev/sdns/middleware/cache Index | Files

package cache

import "github.com/semihalev/sdns/middleware/cache"

Index

Package Files

cache.go item.go

func AcquireMsg Uses

func AcquireMsg() *dns.Msg

AcquireMsg returns an empty msg from pool

func ReleaseMsg Uses

func ReleaseMsg(m *dns.Msg)

ReleaseMsg returns msg to pool

type Cache Uses

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

Cache type

func New Uses

func New(cfg *config.Config) *Cache

New return cache

func (*Cache) GetN Uses

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

GetN returns negative entry for a key

func (*Cache) GetP Uses

func (c *Cache) GetP(key uint64, req *dns.Msg) (*dns.Msg, *rate.Limiter, error)

GetP returns positive entry for a key

func (*Cache) Name Uses

func (c *Cache) Name() string

Name return middleware name

func (*Cache) ServeDNS Uses

func (c *Cache) ServeDNS(ctx context.Context, ch *middleware.Chain)

ServeDNS implements the Handle interface.

func (*Cache) Set Uses

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 Uses

type ResponseWriter struct {
    middleware.ResponseWriter

    *Cache
}

ResponseWriter implement of ctx.ResponseWriter

func (*ResponseWriter) WriteMsg Uses

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

WriteMsg implements the ctx.ResponseWriter interface

Package cache imports 13 packages (graph) and is imported by 1 packages. Updated 2020-10-28. Refresh now. Tools for package owners.