1
0
mirror of https://github.com/danog/dns.git synced 2024-11-30 04:29:06 +01:00

Restrict caching to max one day

This commit is contained in:
Niklas Keller 2017-06-25 21:00:30 +02:00
parent 2167251966
commit cbffb766f3

View File

@ -223,9 +223,10 @@ final class BasicResolver implements Resolver {
/** @var \LibDNS\Records\Resource $record */
foreach ($answers as $record) {
$recordType = $record->getType();
$result[$recordType][] = (string) $record->getData();
$ttls[$recordType] = \min($ttls[$recordType] ?? \PHP_INT_MAX, $record->getTTL());
// Cache for max one day
$ttls[$recordType] = \min($ttls[$recordType] ?? 86400, $record->getTTL());
}
foreach ($result as $recordType => $records) {