diff --git a/lib/CacheFactory.php b/lib/CacheFactory.php new file mode 100644 index 0000000..8aee8a0 --- /dev/null +++ b/lib/CacheFactory.php @@ -0,0 +1,23 @@ +reactor = $reactor ?: \Amp\reactor(); $this->requestBuilder = $requestBuilder ?: new RequestBuilder; $this->responseInterpreter = $responseInterpreter ?: new ResponseInterpreter; - - if (!$cache) { - if (extension_loaded('apc') && ini_get("apc.enabled") && @apc_cache_info()) { - $cache = new APCCache; - } - else { - $cache = new MemoryCache; - } - } - - $this->cache = $cache; + $this->cache = $cache ?: (new CacheFactory)->select(); } /**