1
0
mirror of https://github.com/danog/dns.git synced 2024-12-02 17:38:05 +01:00
dns/lib/Addr/Cache.php

36 lines
861 B
PHP
Raw Normal View History

2014-06-13 19:17:49 +02:00
<?php
namespace Addr;
2014-06-15 23:52:02 +02:00
/**
* Interface for record caches
*
* @package Addr
*/
interface Cache
2014-06-13 19:17:49 +02:00
{
/**
* Look up a name in the cache
*
2014-06-15 23:52:02 +02:00
* @param string $name Name to query
2014-06-16 19:30:28 +02:00
* @param int $type AddressModes::INET4_ADDR or AddressModes::INET6_ADDR
* @param callable $callback Function to receive the result
2014-06-13 19:17:49 +02:00
*/
public function resolve($name, $type, callable $callback);
2014-06-13 19:17:49 +02:00
/**
* Store an entry in the cache
*
2014-06-15 23:52:02 +02:00
* @param string $name Name to query
* @param string $addr IP address that $name maps to
* @param int $type AddressModes::INET4_ADDR or AddressModes::INET6_ADDR
* @param int $ttl Time the record should live, in seconds
2014-06-13 19:17:49 +02:00
*/
2014-06-15 23:52:02 +02:00
public function store($name, $addr, $type, $ttl);
/**
2014-06-15 23:52:02 +02:00
* Remove all expired records from the cache
*/
2014-06-15 23:52:02 +02:00
public function collectGarbage();
2014-06-13 19:17:49 +02:00
}