Net::DNSServer::DBMCache - AnyDBM_File DNS Cache resolver


Net-DNSServer documentation  | view source Contained in the Net-DNSServer distribution.

Index


SYNOPSIS

Top

  #!/usr/bin/perl -w -T
  use strict;
  use Net::DNSServer;
  use Net::DNSServer::DBMCache;

  my $resolver1 = new Net::DNSServer::DBMCache {
    dbm_file    => "/var/named/dns_cache.db",
    dbm_reorder => [qw(DB_File GDBM_File NDBM_File)],
    fresh       => 1,
  };
  my $resolver2 = ... another resolver object ...;
  run Net::DNSServer {
    priority => [$resolver1,$resolver2],
  };

DESCRIPTION

Top

A Net::DNSServer::Base which uses AnyDBM_File with locking to implement a DNS Cache on disk to allow the cache to be shared across processes. This is useful if the server forks (Net::Server::PreFork) and to preserve memory by not having to store large caches in memory.

This resolver will cache responses that another module resolves complying with the corresponding TTL of the response. It cannot provide resolution for a request unless it already exists within its cache. This resolver is useful for servers that may fork, because the cache is stored on disk instead of in memory.

new

The new() method takes a hash ref of properties.

dbm_file (required)

dbm_file is the path to the database file to use and/or create. (Passed to the tie call.)

fresh (optional)

Whether or not to use a fresh cache at server startup. 0 means to reuse the dbm_file cache if one exists. 1 means to start fresh and to wipe the database file at server startup and shutdown and restart. It defaults to 0 meaning it will try to keep and reuse the database file it creates.

AUTHOR

Top

Rob Brown, rob@roobik.com

SEE ALSO

Top

AnyDBM_File Storable Net::Server::PreFork

COPYRIGHT

Top


Net-DNSServer documentation  | view source Contained in the Net-DNSServer distribution.