Skip to content

Commit

Permalink
Add caching support for Net_DNS2_Resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed May 15, 2014
1 parent 46353e4 commit 91ca449
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion framework/Core/lib/Horde/Core/Factory/Dns.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,18 @@ public function create(Horde_Injector $injector)
return null;
}

$resolver = new Net_DNS2_Resolver();
if ($tmpdir = Horde::getTempDir()) {
$config = array(
'cache_file' => $tmpdir . '/horde_dns.cache',
'cache_size' => 100000,
'cache_type' => 'file',
);
} else {
$config = array();
}

$resolver = new Net_DNS2_Resolver($config);

if (is_readable('/etc/resolv.conf')) {
try {
$resolver->setServers('/etc/resolv.conf');
Expand Down

0 comments on commit 91ca449

Please sign in to comment.