Clean up Core\Cache file

- Remove unused use statement
- Use explicit types for Memcache object
This commit is contained in:
Hypolite Petovan 2018-02-03 00:43:57 -05:00
parent ae68196e8d
commit 55c63949c4

View file

@ -5,7 +5,6 @@
namespace Friendica\Core; namespace Friendica\Core;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use dba; use dba;
@ -17,13 +16,13 @@ require_once 'include/dba.php';
class Cache class Cache
{ {
/** /**
* @brief Check for memcache and open a connection if configured * @brief Check for Memcache and open a connection if configured
* *
* @return object|boolean The memcache object - or "false" if not successful * @return Memcache|boolean The Memcache object - or "false" if not successful
*/ */
public static function memcache() public static function memcache()
{ {
if (!function_exists('memcache_connect')) { if (!class_exists('\Memcache', false)) {
return false; return false;
} }
@ -34,7 +33,7 @@ class Cache
$memcache_host = Config::get('system', 'memcache_host', '127.0.0.1'); $memcache_host = Config::get('system', 'memcache_host', '127.0.0.1');
$memcache_port = Config::get('system', 'memcache_port', 11211); $memcache_port = Config::get('system', 'memcache_port', 11211);
$memcache = new \Memcache; $memcache = new \Memcache();
if (!$memcache->connect($memcache_host, $memcache_port)) { if (!$memcache->connect($memcache_host, $memcache_port)) {
return false; return false;