改名
This commit is contained in:
@@ -199,10 +199,12 @@ class Connection extends Component
|
|||||||
/**
|
/**
|
||||||
* @return \Snowflake\Pool\Connection
|
* @return \Snowflake\Pool\Connection
|
||||||
* @throws ComponentException
|
* @throws ComponentException
|
||||||
|
* @throws NotFindClassException
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
private function connections(): \Snowflake\Pool\Connection
|
private function connections(): \Snowflake\Pool\Connection
|
||||||
{
|
{
|
||||||
return Snowflake::app()->getConnections();
|
return Snowflake::app()->getMysqlFromPool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -286,8 +288,9 @@ class Connection extends Component
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 临时回收
|
|
||||||
* @throws ComponentException
|
* @throws ComponentException
|
||||||
|
* @throws NotFindClassException
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public function recovery()
|
public function recovery()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -286,25 +286,28 @@ abstract class BaseApplication extends Service
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Connection
|
* @return Connection
|
||||||
|
* @throws ComponentException
|
||||||
|
* @throws NotFindClassException
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
* @throws NotFindClassException|ComponentException
|
|
||||||
*/
|
*/
|
||||||
public function getConnections(): Connection
|
public function getMysqlFromPool(): Connection
|
||||||
{
|
{
|
||||||
return $this->get('connections');
|
return $this->get('pool')->getDb();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return SPool
|
* @throws ComponentException
|
||||||
|
* @throws NotFindClassException
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
* @throws NotFindClassException|ComponentException
|
* @return SRedis
|
||||||
*/
|
*/
|
||||||
public function getPool(): SPool
|
public function getRedisFromPool(): SRedis
|
||||||
{
|
{
|
||||||
return $this->get('pool');
|
return $this->get('pool')->getRedis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Response
|
* @return Response
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
|
|||||||
+12
-7
@@ -10,11 +10,13 @@ declare(strict_types=1);
|
|||||||
namespace Snowflake\Cache;
|
namespace Snowflake\Cache;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use ReflectionException;
|
||||||
use Snowflake\Abstracts\Component;
|
use Snowflake\Abstracts\Component;
|
||||||
use Snowflake\Abstracts\Config;
|
use Snowflake\Abstracts\Config;
|
||||||
use Snowflake\Event;
|
use Snowflake\Event;
|
||||||
use Snowflake\Exception\ComponentException;
|
use Snowflake\Exception\ComponentException;
|
||||||
use Snowflake\Exception\ConfigException;
|
use Snowflake\Exception\ConfigException;
|
||||||
|
use Snowflake\Exception\NotFindClassException;
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,12 +46,14 @@ class Redis extends Component
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws ConfigException
|
|
||||||
* @throws ComponentException
|
* @throws ComponentException
|
||||||
|
* @throws ConfigException
|
||||||
|
* @throws ReflectionException
|
||||||
|
* @throws NotFindClassException
|
||||||
*/
|
*/
|
||||||
public function createPool()
|
public function createPool()
|
||||||
{
|
{
|
||||||
$connections = Snowflake::app()->getPool()->getRedis();
|
$connections = Snowflake::app()->getRedisFromPool();
|
||||||
|
|
||||||
$config = $this->get_config();
|
$config = $this->get_config();
|
||||||
$name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases'];
|
$name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases'];
|
||||||
@@ -110,13 +114,14 @@ SCRIPT;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 释放连接池
|
|
||||||
* @throws ConfigException
|
|
||||||
* @throws ComponentException
|
* @throws ComponentException
|
||||||
|
* @throws ConfigException
|
||||||
|
* @throws NotFindClassException
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public function release()
|
public function release()
|
||||||
{
|
{
|
||||||
$connections = Snowflake::app()->getPool()->getRedis();
|
$connections = Snowflake::app()->getRedisFromPool();
|
||||||
$connections->release($this->get_config(), true);
|
$connections->release($this->get_config(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +133,7 @@ SCRIPT;
|
|||||||
*/
|
*/
|
||||||
public function destroy()
|
public function destroy()
|
||||||
{
|
{
|
||||||
$connections = Snowflake::app()->getPool()->getRedis();
|
$connections = Snowflake::app()->getRedisFromPool();
|
||||||
$connections->destroy($this->get_config(), true);
|
$connections->destroy($this->get_config(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +143,7 @@ SCRIPT;
|
|||||||
*/
|
*/
|
||||||
public function proxy(): \Redis
|
public function proxy(): \Redis
|
||||||
{
|
{
|
||||||
$connections = Snowflake::app()->getPool()->getRedis();
|
$connections = Snowflake::app()->getRedisFromPool();
|
||||||
|
|
||||||
$client = $connections->get($this->get_config(), true);
|
$client = $connections->get($this->get_config(), true);
|
||||||
if (!($client instanceof \Redis)) {
|
if (!($client instanceof \Redis)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user