]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
doc: updated documentation for cache backends
authorMarek Vavruša <marek.vavrusa@nic.cz>
Sun, 3 May 2015 19:16:29 +0000 (21:16 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Sun, 3 May 2015 19:16:29 +0000 (21:16 +0200)
daemon/README.rst
modules/cachectl/README.rst
modules/hints/README.rst

index dff2e49417f1b93b58bd624d5def87c42d29f808..631b329ede6a7550c123cbf20bc5ee22611fec18 100644 (file)
@@ -335,7 +335,21 @@ The cache in Knot DNS Resolver is persistent with LMDB backend, this means that
 the cached data on restart or crash to avoid cold-starts. The cache may be reused between cache
 daemons or manipulated from other processes, making for example synchronised load-balanced recursors possible.
 
-.. function:: cache.open(max_size)
+.. function:: cache.backends()
+
+   :return: map of backends
+
+   The cache supports runtime-changeable backends, using the optional :rfc:`3986` URI, where the scheme
+   represents backend protocol and the rest of the URI backend-specific configuration. By default, it
+   is a ``lmdb`` backend in working directory, i.e. ``lmdb://``.
+
+   Example output:
+
+   .. code-block:: lua
+
+       [lmdb://] => true
+
+.. function:: cache.open(max_size[, config_uri])
 
    :param number max_size: Maximum cache size in bytes.
    :return: boolean
@@ -345,6 +359,13 @@ daemons or manipulated from other processes, making for example synchronised loa
 
    .. tip:: Use ``kB, MB, GB`` constants as a multiplier, e.g. ``100*MB``.
 
+   The cache supports runtime-changeable backends, see :func:`cache.backends()` for mor information and
+   default. Refer to specific documentation of specific backends for configuration string syntax.
+
+   - ``lmdb://``
+
+   As of now it only allows you to change the cache directory, e.g. ``lmdb:///tmp/cachedir``.
+
 .. function:: cache.count()
 
    :return: Number of entries in the cache.
@@ -355,13 +376,15 @@ daemons or manipulated from other processes, making for example synchronised loa
 
    Close the cache.
 
+   .. note:: This may or may not clear the cache, depending on the used backend. See :func:`cachectl.clear()`. 
 
 Timers and events
 ^^^^^^^^^^^^^^^^^
 
-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 miliseconds, 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.
+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.
 
 .. function:: event.after(time, function)
 
index 448049cbad8016299220e751bf5f148b7dacb801..abe5b577494a6f0acd030fac511c253f98ad39a1 100644 (file)
@@ -6,13 +6,14 @@ Module providing an interface to cache database, for inspection, manipulation an
 Properties
 ^^^^^^^^^^
 
-``prune``
-       Prune expired/invalid records.
+.. function:: cachectl.prune()
 
-       :Input:  N/A
-       :Output: ``{ pruned: int }``
-``clear``
-       Clear all cache records.
+  :return: ``{ pruned: int }``
 
-       :Input:  N/A
-       :Output: ``{ result: bool }``
+  Prune expired/invalid records.
+
+.. function:: cachectl.clear()
+
+  :return: ``{ result: bool }``
+
+  Clear all cache records.
index b7ddf618a5550440d2dabf16529a40976c7b1e0f..0b83ced7e717c3222486517e219bda680d8d7706 100644 (file)
@@ -8,20 +8,23 @@ This is a module providing static hints from ``/etc/hosts`` like file.
 Properties
 ^^^^^^^^^^
 
-``config``
-       Load specified hosts file.
+.. function:: hints.config([path])
 
-       :Input:  ``path`` i.e. ``"/etc/hosts"``
-       :Output: ``{ result: bool }``
+  :param string path:  path to hosts file, default: ``"/etc/hosts"``
+  :return: ``{ result: bool }``
+  
+  Load specified hosts file.
 
-``get``
-       Return list of address record matching given name.
+.. function:: hints.get(hostname)
 
-       :Input:  ``hostname`` i.e. ``"localhost"``
-       :Output: ``{ result: [address1, address2, ...] }``
+  :param string hostname: i.e. ``"localhost"``
+  :return: ``{ result: [address1, address2, ...] }``
 
-``set``
-       Set hostname - address hint.
+  Return list of address record matching given name.
 
-       :Input:  ``hostname address`` i.e. ``"localhost 127.0.0.1"``
-       :Output: ``{ result: bool }``
\ No newline at end of file
+.. function:: hints.set(pair)
+
+  :param string pair:  ``hostname address`` i.e. ``"localhost 127.0.0.1"``
+  :return: ``{ result: bool }``
+
+  Set hostname - address pair hint.