diff --git a/docs/config/cache.md b/docs/config/cache.md index 10d49d9..81e6bee 100644 --- a/docs/config/cache.md +++ b/docs/config/cache.md @@ -64,10 +64,13 @@ sequenceDiagram 现实中,大部分情况下,修改域名IP地址后,是不会立即生效到千家万户的,因为一般IP变化域名后,全球域名系统刷新完成最长可能要72小时。 即时出现过期缓存中的IP地址,故障失效,smartdns返回给客户端过期IP的TTL只有3s,那么3s后,客户端就会重新使用新的IP,表现在客户端程序中,可能就是要刷新页面重试一次。 -并且,针对实现场景,smartdns可以设置预获取来尽量避免此问题发生。 +并且,针对实现场景,smartdns可以设置预获取`prefetch-domain yes`来尽量避免此问题发生。 所以,主要场景下开启过期缓存是比较好的实践。 +注意:`prefetch-domain yes`功能,在开启过期缓存功能的情况下,行为和未开启有差别,开启过期缓存的情况下,仅当域名要从缓存中过期时,才进行预读取,而不是TTL超时获取。 +所以,开启了过期缓存的情况下,推荐开启域名预获取功能。 + ## 配置步骤 1. 开启过期缓存 @@ -108,3 +111,11 @@ sequenceDiagram ```shell domain-rules /example.com/ -no-cache ``` + +## 设置cache定时保存 + +1. 为避免cache因为系统或进程复位丢失,可以设置smartdns周期保存cache文件。 + + ```shell + cache-checkpoint-time 86400 + ``` diff --git a/docs/configuration.md b/docs/configuration.md index bd99cec..6754f29 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -30,7 +30,7 @@ hide: | rr-ttl-reply-max | 允许返回给客户端的最大 TTL 值 | 远程查询结果 | 大于 0 的数字 | rr-ttl-reply-max 60 | | local-ttl | 本地HOST,address的TTL值 | rr-ttl-min | 大于 0 的数字 | local-ttl 60 | | max-reply-ip-num | 允许返回给客户的最大IP数量 | IP数量 | 大于 0 的数字 | max-reply-ip-num 1 | -| log-level | 设置日志级别 | error | fatal、error、warn、notice、info 或 debug | log-level error | +| log-level | 设置日志级别 | error | off、fatal、error、warn、notice、info 或 debug | log-level error | | log-file | 日志文件路径 | /var/log/
smartdns/
smartdns.log | 合法路径字符串 | log-file /var/log/smartdns/smartdns.log | | log-size | 日志大小 | 128K | 数字 + K、M 或 G | log-size 128K | | log-num | 日志归档个数 | openwrt为2, 其他系统为8 | 大于等于 0 的数字,0表示禁用日志 | log-num 2 | diff --git a/en/docs/config/cache.md b/en/docs/config/cache.md index 305b1e1..31500f3 100644 --- a/en/docs/config/cache.md +++ b/en/docs/config/cache.md @@ -43,7 +43,6 @@ The specific principle of optimistic caching can refer to (RFC 8767) (https://ww The process for SmartDNS to handle expired cache is as follows: - ```mermaid %%{init: {'theme':'forest'}}%% @@ -107,3 +106,11 @@ Therefore, it is a good practice to enable expired cache in the main scenario. ```shell domain-rules /example.com/ -no-cache ``` + +## Set cache save interval + +1. To avoid losing the cache due to system or process restart, you can configure SmartDNS to periodically save the cache file. + + ```shell + cache-checkpoint-time 86400 + ``` diff --git a/en/docs/configuration.md b/en/docs/configuration.md index 53f5710..4f388e4 100644 --- a/en/docs/configuration.md +++ b/en/docs/configuration.md @@ -26,7 +26,7 @@ hide: |rr-ttl-reply-max|Domain name Minimum Reply TTL|Remote query result|number greater than 0|rr-ttl-reply-max 60 |rr-ttl-max|Domain name Maximum TTL|Remote query result|number greater than 0|rr-ttl-max 600 |max-reply-ip-num|Maximum number of IPs returned to the client|8|number of IPs, 1~16 |max-reply-ip-num 1 -|log-level|log level|error|fatal,error,warn,notice,info,debug|log-level error +|log-level|log level|error|off,fatal,error,warn,notice,info,debug|log-level error |log-file|log path|/var/log/
smartdns/
smartdns.log|File Pah|log-file /var/log/smartdns/smartdns.log |log-size|log size|128K|number+K,M,G|log-size 128K |log-num|archived log number|2 for openwrt, 8 for other system|Integer, 0 means turn off the log|log-num 2