diff options
author | Martin Polden <mpolden@mpolden.no> | 2020-01-11 22:21:43 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2020-01-11 22:25:39 +0100 |
commit | 644b439d17a92d16c06e298148b0a69599205ef3 (patch) | |
tree | 7c74751978ea58f21ef43bc284964e98f992f8d9 /cache | |
parent | 5b6af76040cd6d17972522629605f20aeeaa4076 (diff) |
Update documentation
Diffstat (limited to 'cache')
-rw-r--r-- | cache/cache.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cache/cache.go b/cache/cache.go index a31aeff..a0218b0 100644 --- a/cache/cache.go +++ b/cache/cache.go @@ -14,7 +14,7 @@ import ( "github.com/mpolden/zdns/dns/dnsutil" ) -// Backend is the interface for a persistent cache backend. +// Backend is the interface for a cache backend. All write operations in a Cache are forwarded to a Backend. type Backend interface { Set(key uint32, value Value) Evict(key uint32) @@ -109,7 +109,11 @@ func Unpack(value string) (Value, error) { // New creates a new cache of given capacity. // // If client is non-nil, the cache will prefetch expired entries in an effort to serve results faster. -// If backend is non-nil, the cache will use it to persist cache entries. +// +// If backend is non-nil: +// +// - All cache write operations will be forward to the backend. +// - The backed will be used to pre-populate the cache. func New(capacity int, client *dnsutil.Client) *Cache { return NewWithBackend(capacity, client, &defaultBackend{}) } |