Documentation
¶
Overview ¶
Package cache implements dns cache feature with edns-client-subnet support.
Index ¶
- func Key(q dns.Question, ednsIP string) string
- type Cache
- func (c *Cache) Capacity() int
- func (c *Cache) Dump(nobody bool) (rs map[string][]string, l int)
- func (c *Cache) EvictRandom()
- func (c *Cache) Hit(key string, msgid uint16) *dns.Msg
- func (c *Cache) InsertMessage(s string, m *dns.Msg, mTTL uint32)
- func (c *Cache) Remove(s string)
- func (c *Cache) Search(s string) (*dns.Msg, time.Time, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
Cache is a cache that holds on the a number of RRs or DNS messages. The cache eviction is randomized.
func (*Cache) EvictRandom ¶
func (c *Cache) EvictRandom()
EvictRandom removes a random member a the cache. Must be called under a write lock.
func (*Cache) Hit ¶
Hit returns a dns message from the cache. If the message's TTL is expired nil is returned and the message is removed from the cache.
func (*Cache) InsertMessage ¶
InsertMessage inserts a message in the Cache. We will cache it for ttl seconds, which should be a small (60...300) integer.
Click to show internal directories.
Click to hide internal directories.