[GH-ISSUE #138] DNS代理,没有定时保存缓存结果到文件.重启会降低查询速度. #75

Closed
opened 2026-02-27 23:15:19 +03:00 by kerem · 1 comment
Owner

Originally created by @snail007 on GitHub (Sep 11, 2018).
Original GitHub issue: https://github.com/snail007/goproxy/issues/138

Originally assigned to: @snail007 on GitHub.

demo:

                cache = gocache.New(time.Second*time.Duration(dnsTTL), time.Second*60)
		cache.LoadFile(cacheFile)
		go func() {
			timer := time.NewTicker(time.Second * 300)
			for {
				<-timer.C
                                cache.DeleteExpired()
				cache.SaveFile(cacheFile)
			}
		}()
Originally created by @snail007 on GitHub (Sep 11, 2018). Original GitHub issue: https://github.com/snail007/goproxy/issues/138 Originally assigned to: @snail007 on GitHub. demo: ```golang cache = gocache.New(time.Second*time.Duration(dnsTTL), time.Second*60) cache.LoadFile(cacheFile) go func() { timer := time.NewTicker(time.Second * 300) for { <-timer.C cache.DeleteExpired() cache.SaveFile(cacheFile) } }() ```
kerem closed this issue 2026-02-27 23:15:20 +03:00
Author
Owner

@snail007 commented on GitHub (Oct 18, 2018):

fixed

<!-- gh-comment-id:430858246 --> @snail007 commented on GitHub (Oct 18, 2018): fixed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/goproxy#75
No description provided.