NAME
Net::DNSServer::DBMCache - AnyDBM_File DNS Cache resolver
SYNOPSIS
#!/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
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.)
dbm_reorder (recommended)
This is used to set @AnyDBM_File::ISA before running import and determines which order to attempt to format the database with.
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
Rob Brown, rob@roobik.com
SEE ALSO
AnyDBM_File Storable Net::Server::PreFork
COPYRIGHT
Copyright (c) 2001, Rob Brown. All rights reserved. Net::DNSServer is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
$Id: DBMCache.pm,v 1.12 2002/06/07 22:55:08 rob Exp $