cache

package
v1.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package cache provides caching functionality for DNS records and zones.

Package cache provides caching functionality for DNS records and zones.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RecordsCache

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

RecordsCache provides caching for DNS records using Ristretto cache. It stores a mapping of cache keys to lists of DNS records.

func NewRecordsCache

func NewRecordsCache(capacity int) (*RecordsCache, error)

NewRecordsCache creates a new RecordsCache instance with the specified capacity. The capacity determines the maximum number of items that can be stored in the cache. Returns the cache instance and any error encountered during initialization.

func (*RecordsCache) Delete

func (c *RecordsCache) Delete(key string)

func (*RecordsCache) Get

func (c *RecordsCache) Get(key string) ([]*m.Record, bool)

Get retrieves a list of records from the cache for the given key. Returns the records and a boolean indicating if the key was found.

func (*RecordsCache) Set

func (c *RecordsCache) Set(key string, value []*m.Record)

Set stores a list of records in the cache with the given key. The TTL is determined by the minimum TTL among all records in the list. The cost is calculated based on the length of the records slice.

type ZonesCache

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

ZonesCache provides caching for DNS zones using Ristretto cache. It stores a mapping of cache keys to lists of zone names.

func NewZonesCache

func NewZonesCache() (*ZonesCache, error)

NewZonesCache creates a new ZonesCache instance with default configuration. Returns the cache instance and any error encountered during initialization.

func (*ZonesCache) Delete

func (c *ZonesCache) Delete(key string)

func (*ZonesCache) Get

func (c *ZonesCache) Get(key string) ([]string, bool)

Get retrieves a list of zones from the cache for the given key. Returns the zones and a boolean indicating if the key was found.

func (*ZonesCache) Set

func (c *ZonesCache) Set(key string, value []string)

Set stores a list of zones in the cache with the given key. The cost is calculated based on the length of the zones slice.

Jump to

Keyboard shortcuts

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