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

Fix memory cache lookup handling

This commit is contained in:
Chris Wright 2014-07-20 00:15:33 +01:00
parent 6df50e2fc8
commit 10bd03789c

View File

@ -23,15 +23,12 @@ class MemoryCache implements Cache
*/
public function resolve($name, $type, callable $callback)
{
if (isset($this->data[$type][$name])) {
if ($this->data[$type][$name][1] >= time()) {
$callback($this->data[$type][$name][0]);
}
if (!isset($this->data[$type][$name]) || $this->data[$type][$name][1] < time()) {
unset($this->data[$type][$name]);
$callback(null);
} else {
$callback($this->data[$type][$name][0]);
}
$callback($this->data[$type][$name][0]);
}
/**