# Rescached

rescached is a daemon to cache internet name and address resolution in local memory when running and in a disk cache when not running.

rescached is not a reimplementation of a DNS server like BIND. The primary goal of rescached is only to cache DNS queries and answers to minimize unneeded traffic to the outside network. It is intended for personal systems or serving a small group of users.

## Features

- Enable to handle requests via UDP and TCP
- Saving/loading cache to/from disk
- Load and serve addresses and hostnames in `/etc/hosts`

## How cache in rescached works

Each query and answer data pair in the cache is enriched with statistical usage to define how the cache will be ordered in memory. The frequently queried hostnames will be at the top of the cache list, and less queried hostnames will be at the bottom of the cache list. This, obviously, results in a cache list based on user's habits (frequently accessed hosts) and speeds up resolving accordingly.

    +-----+------------------+
    | #   | host-name        |
    +-----+------------------+
    | 529 | www.reddit.com   |
    +-----+------------------+
    | 233 | www.google.com   |
    +-----+------------------+
    | ... |        ...       |
    +-----+------------------+
    | 1   | www.kilabit.info |
    +-----+------------------+

The number of cache entries that rescached holds in memory depends on the value of cache.max in the configuration file. When the cache.max limit is reached, the daemon will remove all cached entries which are accessed less frequently than set in cache.threshold.

## Installation

Install the rescached-gitAUR package.

## Post-installation configuration

The default configuration enables a direct start of the daemon.

Rescached configuration resides in `/etc/rescached/rescached.cfg`. Select entries to change are:

- Set your parent DNS server:

  Change the value of `server.parent` based on your preferred DNS server.

- Set maximum caches.

  Change the value of `cache.max` and/or `cache.threshold` to match your needs.

After finishing the configuration file, set your system DNS server to point to rescached:

      # mv /etc/resolv.conf /etc/resolv.conf.org
      # echo "nameserver 127.0.0.1" > /etc/resolv.conf

Finally, start and possibly enable `rescached.service`.

## See also

- For more information and configuration see the manpage of rescached
- For non-technical explanation you can read it here
- For user documentation you can read it here
- Report bug and feature requests are preferred on the github

Category:

- Domain Name System