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
|
|
|
{
|
2014-06-15 01:47:15 +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
|
2014-07-18 02:07:01 +02:00
|
|
|
* @param callable $callback Function to receive the result
|
2014-06-13 19:17:49 +02:00
|
|
|
*/
|
2014-07-18 02:07:01 +02:00
|
|
|
public function resolve($name, $type, callable $callback);
|
2014-06-13 19:17:49 +02:00
|
|
|
|
|
|
|
/**
|
2014-06-15 01:47:15 +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 01:47:15 +02:00
|
|
|
|
|
|
|
/**
|
2014-06-15 23:52:02 +02:00
|
|
|
* Remove all expired records from the cache
|
2014-06-15 01:47:15 +02:00
|
|
|
*/
|
2014-06-15 23:52:02 +02:00
|
|
|
public function collectGarbage();
|
2014-06-13 19:17:49 +02:00
|
|
|
}
|