1
0
mirror of https://github.com/danog/dns.git synced 2024-11-30 04:29:06 +01:00
dns/lib/CacheFactory.php
2014-11-26 16:05:50 +00:00

24 lines
455 B
PHP

<?php
namespace Amp\Dns;
use Amp\Dns\Cache\MemoryCache;
use Amp\Dns\Cache\APCCache;
class CacheFactory
{
/**
* Get an instance of the best available caching back-end that does not have any dependencies
*
* @return Cache
*/
public function select()
{
if (extension_loaded('apc') && ini_get("apc.enabled") && @apc_cache_info()) {
return new APCCache;
}
return new MemoryCache;
}
}