Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能否解释下min_ttl、max_ttl含义 #16

Closed
36bian opened this issue Apr 24, 2020 · 3 comments
Closed

能否解释下min_ttl、max_ttl含义 #16

36bian opened this issue Apr 24, 2020 · 3 comments

Comments

@36bian
Copy link

36bian commented Apr 24, 2020

摘自配置文件

[cache]  # dns缓存配置
size = 4096  # 缓存大小,为负数时禁用缓存
min_ttl = 60  # 最小ttl,单位为秒
max_ttl = 86400  # 最大ttl,单位为秒

我不太理解最小和最大是怎么回事,不应该是一个固定值么,表示ts-dns本身将会缓存该解析多长时间

@wolf-joe
Copy link
Owner

wolf-joe commented Apr 24, 2020

对权威DNS服务器来说,记录的TTL是固定的,代表这个记录可以被缓存的时间。对于递归DNS服务器或缓存服务器(比如ts-dns)来说,这个值是动态的,代表这个记录的缓存再过多久会失效、需要重新向权威服务器查询。

@36bian
Copy link
Author

36bian commented Apr 24, 2020

我不明白的就是这点,如果是动态的话,过期时间到底是看min_ttl还是max_ttl

@wolf-joe
Copy link
Owner

抱歉,没解释清楚。
即使上游dns告诉ts-dns:“你查到的dns记录马上就要过期了”,ts-dns也会在min_ttl秒后才会再次向上游dns请求相同的记录;
即使上游dns告诉ts-dns:“你查到的dns永远不会过期”,ts-dns也会在max_ttl秒后就再次向上游dns请求相同的记录。
总而言之,min_ttlmax_ttl存在的意义就是保证ts-dns里dns记录被缓存的时间不至于太长或太短。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants