diff --git a/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua b/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua index 5533067..ef621da 100644 --- a/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua +++ b/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua @@ -8,7 +8,7 @@ else end m = Map("mosdns") m.title = translate("MosDNS") .. " " .. mosdns_version -m.description = translate("MosDNS is a 'programmable' DNS forwarder.") +m.description = translate("MosDNS is a plugin-based DNS forwarder/traffic splitter.") m:section(SimpleSection).template = "mosdns/mosdns_status" @@ -135,12 +135,12 @@ o.rmempty = false o.default = false o:depends("configfile", "/etc/mosdns/config.yaml") -o = s:taboption("advanced", Value, "cache_size", translate("DNS Cache Size")) +o = s:taboption("advanced", Value, "cache_size", translate("DNS Cache Size"), translate("DNS cache size (in piece). To disable caching, please set to 0.")) o.datatype = "and(uinteger,min(0))" o.default = "8000" o:depends("configfile", "/etc/mosdns/config.yaml") -o = s:taboption("advanced", Value, "cache_survival_time", translate("Cache Survival Time")) +o = s:taboption("advanced", Value, "cache_survival_time", translate("Lazy Cache TTL"), translate("Lazy cache survival time (in second). To disable Lazy Cache, please set to 0.")) o.datatype = "and(uinteger,min(0))" o.default = "86400" o:depends("configfile", "/etc/mosdns/config.yaml") diff --git a/luci-app-mosdns/po/zh-cn/mosdns.po b/luci-app-mosdns/po/zh-cn/mosdns.po index 7c9beca..94677bb 100644 --- a/luci-app-mosdns/po/zh-cn/mosdns.po +++ b/luci-app-mosdns/po/zh-cn/mosdns.po @@ -13,7 +13,7 @@ msgstr "Cloudflare 选项" msgid "API Options" msgstr "API 选项" -msgid "MosDNS is a 'programmable' DNS forwarder." +msgid "MosDNS is a plugin-based DNS forwarder/traffic splitter." msgstr "MosDNS 是一个插件化的 DNS 转发/分流器。" msgid "RUNNING" @@ -230,10 +230,16 @@ msgid "Enable this option fallback policy forces forwarding to remote DNS" msgstr "启用此选项 fallback 策略会强制转发到远程 DNS" msgid "DNS Cache Size" -msgstr "DNS 缓存大小(条)" +msgstr "DNS 缓存大小" -msgid "Cache Survival Time" -msgstr "缓存生存时间(秒)" +msgid "DNS cache size (in piece). To disable caching, please set to 0." +msgstr "DNS 缓存大小(单位:条),要禁用缓存,请设置为 0" + +msgid "Lazy Cache TTL" +msgstr "乐观缓存 TTL" + +msgid "Lazy cache survival time (in second). To disable Lazy Cache, please set to 0." +msgstr "乐观缓存生存时间(单位:秒),要禁用乐观缓存,请设置为 0" msgid "Cache Dump" msgstr "自动保存缓存" diff --git a/luci-app-mosdns/root/etc/init.d/mosdns b/luci-app-mosdns/root/etc/init.d/mosdns index 6646b72..d46d99c 100755 --- a/luci-app-mosdns/root/etc/init.d/mosdns +++ b/luci-app-mosdns/root/etc/init.d/mosdns @@ -110,6 +110,8 @@ init_yaml() { else sed -i '/\$cloudflare_cidr\|CLOUDFLARE_IP/d' $CONF fi + # disable lazy_cache plugin when cache_size is 0 + [ $cache_size -eq 0 ] && sed -i -E ':l;N;/exec: \$lazy_cache/s/(\n[^\n]*){6}$//;bl' $CONF rm -rf $TMPDIR }