memory

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryCache

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

MemoryCache is an in-memory cache.

func New

func New() (*MemoryCache, error)

New creates a new in-memory cache.

func (*MemoryCache) Clear

func (c *MemoryCache) Clear() error

Clear clears the cache.

func (*MemoryCache) Close

func (c *MemoryCache) Close() error

Close closes the cache.

func (*MemoryCache) Delete

func (c *MemoryCache) Delete(domain string) error

Delete deletes the value for the given key.

func (*MemoryCache) Exists

func (c *MemoryCache) Exists(domain string) bool

Exists returns true if the key exists.

func (*MemoryCache) Get

func (c *MemoryCache) Get(domain string) ([]dns.RR, error)

Get returns the value for the given key.

func (*MemoryCache) GetAll

func (c *MemoryCache) GetAll() map[string]base.CacheValue

GetAll returns all the values in the cache.

func (*MemoryCache) GetExpireAt

func (c *MemoryCache) GetExpireAt(domain string) time.Time

GetExpireAt returns the expiration time.

func (*MemoryCache) HasExpired

func (c *MemoryCache) HasExpired(domain string) bool

HasExpired returns true if the key has expired.

func (*MemoryCache) Keys

func (c *MemoryCache) Keys() []string

Keys returns the keys in the cache.

func (*MemoryCache) Len

func (c *MemoryCache) Len() int

Len returns the number of items in the cache.

func (*MemoryCache) Load

func (c *MemoryCache) Load(data map[string]base.CacheValue) error

Load loads the cache.

func (*MemoryCache) Set

func (c *MemoryCache) Set(domain string, value []dns.RR) error

Set sets the value for the given key.

Jump to

Keyboard shortcuts

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