diff options
author | Martin Polden <mpolden@mpolden.no> | 2019-06-12 23:32:36 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2019-06-12 23:32:36 +0200 |
commit | 58ac25a4b04ba4dc699bc3ef5107084d18085a70 (patch) | |
tree | 02ec10aa91a9ebaee5111617b677eea10ac1119f | |
parent | 10f5f0a1b394e34c8153d552555bec14afa33a7b (diff) |
Reorder fields
-rw-r--r-- | cache/cache.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cache/cache.go b/cache/cache.go index 7eb53e5..69a07cc 100644 --- a/cache/cache.go +++ b/cache/cache.go @@ -13,11 +13,11 @@ import ( // Cache represents a cache of DNS entries. Use New to initialize a new cache. type Cache struct { maxSize int - entries map[uint32]value - keys []uint32 now func() time.Time maintainer *maintainer mu sync.RWMutex + entries map[uint32]value + keys []uint32 } type maintainer struct { @@ -84,7 +84,7 @@ func (c *Cache) Close() error { return nil } -// Get returns the DNS message associated with key k. Get will return nil if any TTL in the answer section of the // +// Get returns the DNS message associated with key k. Get will return nil if any TTL in the answer section of the // message is exceeded according to time t. func (c *Cache) Get(k uint32) (*dns.Msg, bool) { c.mu.RLock() @@ -100,7 +100,7 @@ func (c *Cache) Get(k uint32) (*dns.Msg, bool) { } // Set associated key k with the DNS message v. Message v will expire from the cache according to its TTL. Setting a -// value in a cache that has reached its maximum size will remove the oldest entry. +// new key in a cache that has its maximum size will remove the first key. func (c *Cache) Set(k uint32, v *dns.Msg) { if c.maxSize == 0 { return |