mem_cache

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemCache

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

MemCache is a simple cache that stores msgs in memory.

func NewMemCache

func NewMemCache(shardNum, maxSizePerShard int, cleanerInterval time.Duration) *MemCache

NewMemCache returns a MemCache. If cleanerInterval <= 0, MemCache cleaner is disabled.

func (*MemCache) Close

func (c *MemCache) Close() error

Close closes the cleaner

func (*MemCache) Get

func (c *MemCache) Get(_ context.Context, key string, allowExpired bool) (m *dns.Msg, storedTime, expirationTime time.Time, err error)

func (*MemCache) Store

func (c *MemCache) Store(_ context.Context, key string, v *dns.Msg, storedTime, expirationTime time.Time) (err error)

Jump to

Keyboard shortcuts

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