func New(bufferSize int, cacheMaxTTL, cacheMissTTL time.Duration, lookup func(Context, dns.Question) []dns.RR) *Cache {
	c := &Cache{
		requestChan:    make(chan Request, bufferSize),
		responseChan:   make(chan response, bufferSize),
		expirationChan: make(chan cacheKey, bufferSize),
		clearChan:      make(chan struct{}, bufferSize),
		stopChan:       make(chan struct{}, bufferSize),
		cacheMaxTTL:    cacheMaxTTL,
		cacheMissTTL:   cacheMissTTL,
		lookup:         lookup,
	}
	go c.process()
	return c
}
// New creates a DNS cache with the given DNS lookup function
New creates a DNS cache with the given DNS lookup function
// New creates a DNS cache with the given DNS lookup function
func New(bufferSize int, cacheMaxTTL, cacheMissTTL time.Duration, lookup func(Context, dns.Question) []dns.RR) *Cache {
	c := &Cache{
		requestChan:    make(chan Request, bufferSize),
		responseChan:   make(chan response, bufferSize),
		expirationChan: make(chan cacheKey, bufferSize),
		clearChan:      make(chan struct{}, bufferSize),
		stopChan:       make(chan struct{}, bufferSize),
		cacheMaxTTL:    cacheMaxTTL,
		cacheMissTTL:   cacheMissTTL,
		lookup:         lookup,
	}
	go c.process()
	return c
}
func New ( bufferSize int , cacheMaxTTL , cacheMissTTL time . Duration , lookup func ( Context , dns . Question ) [ ] dns . RR ) * Cache { c := & Cache { requestChan : make ( chan Request , bufferSize ) , responseChan : make ( chan response , bufferSize ) , expirationChan : make ( chan cacheKey , bufferSize ) , clearChan : make ( chan struct { } , bufferSize ) , stopChan : make ( chan struct { } , bufferSize ) , cacheMaxTTL : cacheMaxTTL , cacheMissTTL : cacheMissTTL , lookup : lookup , } go c . process ( ) return c }
New creates a DNS cache with the given DNS lookup function
New creates a DNS cache with the given DNS lookup function