************************
-Knot DNS Resolver daemon
+Knot DNS Resolver daemon
************************
The server is in the `daemon` directory, it works out of the box without any configuration.
if cache.count() == 0 then
-- download cache from parent
- http.request {
+ http.request {
url = 'http://parent/cache.mdb',
sink = ltn12.sink.file(io.open('cache.mdb', 'w'))
}
If called with a parameter, it will change kresd's directory for
looking up the dynamic modules. If called without a parameter, it
will return kresd's modules directory.
-
+
.. function:: verbose(true | false)
:return: Toggle verbose logging.
Close the cache.
- .. note:: This may or may not clear the cache, depending on the used backend. See :func:`cache.clear()`.
+ .. note:: This may or may not clear the cache, depending on the used backend. See :func:`cache.clear()`.
.. function:: cache.stats()
Timers and events
^^^^^^^^^^^^^^^^^
-The timer represents exactly the thing described in the examples - it allows you to execute closures
+The timer represents exactly the thing described in the examples - it allows you to execute closures
after specified time, or event recurrent events. Time is always described in milliseconds,
but there are convenient variables that you can use - ``sec, minute, hour``.
For example, ``5 * hour`` represents five hours, or 5*60*60*100 milliseconds.
:return: event id
- Similar to :func:`event.after()`, periodically execute function after ``interval`` passes.
+ Similar to :func:`event.after()`, periodically execute function after ``interval`` passes.
Example:
.. code-block:: lua
msg_count = 0
- event.recurrent(5 * sec, function(e)
+ event.recurrent(5 * sec, function(e)
msg_count = msg_count + 1
print('Hi #'..msg_count)
end)