/** * 返回单列对象 */ public static function getInstance() { if (!extension_loaded('Redis')) { throw new CacheException('[缓存错误]请安装或者启用Redis扩展'); } if (empty(self::$instance)) { self::$instance = new self(); } return self::$instance; }