.. code-block:: lua
-- 10MB cache
- cache.open(10*MB)
- -- static hints
- modules = {
- hints = true,
- cachectl = true
- }
+ cache.size = 10*MB
+ -- load some modules
+ modules = { 'hints', 'cachectl' }
-- interfaces
- net.listen('127.0.0.1')
+ net = { '127.0.0.1' }
Configuration syntax
--------------------
.. code-block:: lua
modules = {
- cachectl = true -- no configuration
+ 'hints' -- no configuration
}
-If the module accepts accepts configuration, you can provide a table.
+If the module accepts accepts configuration, you can call the ``module.config({...})`` or provide options table.
The syntax for table is ``{ key1 = value, key2 = value }``, and it represents the unpacked `JSON-encoded`_ string, that
the modules use as the :ref:`input configuration <mod-properties>`.
modules = {
cachectl = true,
- hints = {
+ hints = { -- with configuration
file = '/etc/hosts'
}
}
-The possible simple data types are strings, integers or floats and boolean.
+The possible simple data types are: string, integer or float, and boolean.
.. tip:: The configuration and CLI syntax is Lua language, with which you may already be familiar with.
If not, you can read the `Learn Lua in 15 minutes`_ for a syntax overview. Spending just a few minutes
sink = ltn12.sink.file(io.open('cache.mdb', 'w'))
}
-- reopen cache with 100M limit
- cache.open('.', 100*MB)
+ cache.open(100*MB)
end
Events and services
.. code-block:: lua
+ modules = { 'cachectl' }
modules = {
hints = {file = '/etc/hosts'}
}
.. code-block:: lua
modules.load('cachectl')
- cachectl.config({file = '/etc/hosts'})
+ modules.load('hints')
+ hints.config({file = '/etc/hosts'})
.. function:: modules.list()