aboutsummaryrefslogtreecommitdiff
path: root/cacheworker.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2019-01-24 00:06:49 +0700
committerShulhan <ms@kilabit.info>2019-01-24 00:26:30 +0700
commit4550ca15f9f7faf5447d859018a19f3ebd2edde8 (patch)
tree90ea743f8516e3120e003682bb69178cf6a6e784 /cacheworker.go
parent437f2a8dcb29ca915d251c59dde7b372c1c0e18b (diff)
downloadrescached-4550ca15f9f7faf5447d859018a19f3ebd2edde8.tar.xz
caches: replace sync.Map with plain map and Mutex
The benchmark output give better performance using plain map with Mutex rather than using sync.Map.
Diffstat (limited to 'cacheworker.go')
-rw-r--r--cacheworker.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/cacheworker.go b/cacheworker.go
index 5f14658..531a7b0 100644
--- a/cacheworker.go
+++ b/cacheworker.go
@@ -39,7 +39,7 @@ func newCacheWorker(pruneDelay, cacheThreshold time.Duration) *cacheWorker {
return &cacheWorker{
upsertQueue: make(chan *dns.Message, maxWorkerQueue),
updateQueue: make(chan *response, maxWorkerQueue),
- caches: &caches{},
+ caches: newCaches(),
cachesRequest: newCachesRequest(),
cachesList: newCachesList(cacheThreshold),
pruneDelay: pruneDelay,