2014-07-19 15:37:48 +02:00
|
|
|
<?php
|
|
|
|
|
2014-07-21 15:12:51 +02:00
|
|
|
namespace Addr;
|
2014-07-19 15:37:48 +02:00
|
|
|
|
2014-07-21 18:48:36 +02:00
|
|
|
interface Cache
|
|
|
|
{
|
2014-07-19 15:37:48 +02:00
|
|
|
/**
|
|
|
|
* Attempt to retrieve a value from the cache
|
|
|
|
*
|
2014-07-22 03:36:05 +02:00
|
|
|
* Callback has the following signature:
|
|
|
|
* void callback ( bool $cacheHit, string $address )
|
|
|
|
*
|
|
|
|
* Called with the following values:
|
|
|
|
* [true, $valueFromCache] - if it existed in the cache
|
|
|
|
* [false, null] - if it didn't exist in the cache
|
|
|
|
*
|
|
|
|
* @param string $name
|
|
|
|
* @param int $type
|
|
|
|
* @param callable $callback
|
2014-07-19 15:37:48 +02:00
|
|
|
*/
|
2014-07-22 03:36:05 +02:00
|
|
|
public function get($name, $type, callable $callback);
|
2014-07-21 18:48:36 +02:00
|
|
|
|
2014-07-19 15:37:48 +02:00
|
|
|
/**
|
2014-07-22 03:36:05 +02:00
|
|
|
* Stores a value in the cache. Overwrites the previous value if there was one.
|
2014-07-21 18:48:36 +02:00
|
|
|
*
|
2014-07-22 03:36:05 +02:00
|
|
|
* @param string $name
|
|
|
|
* @param int $type
|
|
|
|
* @param string $addr
|
|
|
|
* @param int $ttl
|
2014-07-19 15:37:48 +02:00
|
|
|
*/
|
2014-07-22 03:36:05 +02:00
|
|
|
public function store($name, $type, $addr, $ttl);
|
2014-07-19 15:37:48 +02:00
|
|
|
}
|