Zone to Cache

Zone to Cache is a function to load a zone into the Recursor cache periodically, or every time the Lua configuration is loaded, at startup and whenever rec_control reload-lua-config is issued. This allows the Recursor to have an always hot cache for these zones. The zone content to cache can be retrieved via zone transfer (AXFR format) or read from a zone file retrieved via http, https or a local file.


To load the root zone from Internic into the recursor once at startup and when the Lua config is reloaded:

zoneToCache(".", "url", "", { refreshPeriod = 0 })


zoneToCache(zone, method, source[, settings])

New in version 4.6.0.

Load a zone and put it into the Recursor cache periodically.

  • zone (str) – The name of the zone to load
  • method (str) – One of "axfr", "url" or "file"
  • source (str) – A string representing an IP address (when using the axfr method), URL (when using the url method) or path name (when using the file method)
  • settings (table) – A table of settings, see below

Zone to Cache settings

These options can be set in the settings of zoneToCache().


The maximum time (in seconds) a retrieval using the axfr or url method may take. Default is 20 seconds.


The name of the TSIG key to authenticate to the server and validate the zone content with when using the axfr method. When this is set, tsigalgo and tsigsecret must also be set.


The name of the TSIG algorithm (like ‘hmac-md5’) used.


Base64 encoded TSIG secret.


An integer describing the interval (in seconds) to wait between retrievals. A value of zero means the retrieval is done once at startup and on Lua configuration reload. By default, the refresh value is 86400 (24 hours).


An integer describing the interval (in seconds) to wait before retrying a failed transfer. By default 60 is used.


The maximum size in megabytes of an update via the axfr or url methods, to prevent resource exhaustion. The default value of 0 means no restriction.


The source IP address to use when transferring using the axfr or url methods. When unset, query-local-address is used.