package cache
import "github.com/skynetservices/skydns/cache"
Index ¶
- func Key(q dns.Question, dnssec, tcp bool) string
- func KeyRRset(rrs []dns.RR) string
- type Cache
- func New(capacity, ttl int) *Cache
- func (c *Cache) Capacity() int
- func (c *Cache) EvictRandom()
- func (c *Cache) Hit(question dns.Question, dnssec, tcp bool, msgid uint16) *dns.Msg
- func (c *Cache) InsertMessage(s string, msg *dns.Msg)
- func (c *Cache) InsertSignature(s string, sig *dns.RRSIG)
- func (c *Cache) Remove(s string)
- func (c *Cache) Search(s string) (*dns.Msg, time.Time, bool)
Functions ¶
func Key ¶
Key creates a hash key from a question section. It creates a different key for requests with DNSSEC.
func KeyRRset ¶
Key uses the name, type and rdata, which is serialized and then hashed as the key for the lookup.
Types ¶
type Cache ¶
Cache is a cache that holds on the a number of RRs or DNS messages. The cache eviction is randomized.
func New ¶
New returns a new cache with the capacity and the ttl specified.
func (*Cache) Capacity ¶
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.
func (*Cache) InsertSignature ¶
InsertSignature inserts a signature, the expiration time is used as the cache ttl.
func (*Cache) Remove ¶
func (*Cache) Search ¶
Search returns a dns.Msg, the expiration time and a boolean indicating if we found something in the cache.
Source Files ¶
- Version
- v0.0.0-20191015171621-94b2ea0d8bfa (latest)
- Published
- Oct 15, 2019
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 1 month ago –
Tools for package owners.