Documentation ¶
Index ¶
- func Key(q dns.Question, dnssec, tcp bool) string
- func KeyRRset(rrs []dns.RR) string
- type Cache
- func (c *Cache) Capacity() int
- func (c *Cache) EvictRandom()
- func (c *Cache) Hit(question dns.Question, dnssec, tcp bool, msgid uint16) (m1 *dns.Msg, expired bool, key string)
- func (c *Cache) InsertMessage(s string, msg *dns.Msg)
- 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 ¶
func (c *Cache) Hit(question dns.Question, dnssec, tcp bool, msgid uint16) (m1 *dns.Msg, expired bool, key string)
Hit returns a dns message, expired bool, and key from the cache. The caller must decide whether or not to remove the cache entry if expired.
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.