mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-30 02:37:58 +08:00
Update Redis.php
This commit is contained in:
parent
5c137bcd79
commit
fdc59578a4
@ -62,9 +62,6 @@ class Redis implements Adapter
|
|||||||
*/
|
*/
|
||||||
private $connectionInitialized = false;
|
private $connectionInitialized = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* Redis constructor.
|
|
||||||
*/
|
|
||||||
public function __construct(array $options = [])
|
public function __construct(array $options = [])
|
||||||
{
|
{
|
||||||
$this->options = array_merge(self::$defaultOptions, $options);
|
$this->options = array_merge(self::$defaultOptions, $options);
|
||||||
@ -74,7 +71,6 @@ class Redis implements Adapter
|
|||||||
/**
|
/**
|
||||||
* Create an instance from an established redis connection.
|
* Create an instance from an established redis connection.
|
||||||
* @param \Hyperf\Redis\Redis|\Redis $redis
|
* @param \Hyperf\Redis\Redis|\Redis $redis
|
||||||
* @return Redis
|
|
||||||
*/
|
*/
|
||||||
public static function fromExistingConnection($redis): self
|
public static function fromExistingConnection($redis): self
|
||||||
{
|
{
|
||||||
@ -409,14 +405,9 @@ LUA
|
|||||||
return implode(':', [self::$prefix, $data['type'], $data['name']]);
|
return implode(':', [self::$prefix, $data['type'], $data['name']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected function getRedisTag(string $metricType): string
|
||||||
* Adapt redis cluster get tag
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected function getRedisTag($metricType): string
|
|
||||||
{
|
{
|
||||||
switch($metricType)
|
switch($metricType) {
|
||||||
{
|
|
||||||
case Counter::TYPE:
|
case Counter::TYPE:
|
||||||
return "{counter}";
|
return "{counter}";
|
||||||
case Histogram::TYPE:
|
case Histogram::TYPE:
|
||||||
@ -435,8 +426,7 @@ LUA
|
|||||||
*/
|
*/
|
||||||
private function getMetricGatherKey($metricType): string
|
private function getMetricGatherKey($metricType): string
|
||||||
{
|
{
|
||||||
switch($metricType)
|
switch($metricType) {
|
||||||
{
|
|
||||||
case Counter::TYPE:
|
case Counter::TYPE:
|
||||||
return self::$prefix . Counter::TYPE . self::PROMETHEUS_METRIC_KEYS_SUFFIX . $this->getRedisTag(Counter::TYPE);
|
return self::$prefix . Counter::TYPE . self::PROMETHEUS_METRIC_KEYS_SUFFIX . $this->getRedisTag(Counter::TYPE);
|
||||||
case Histogram::TYPE:
|
case Histogram::TYPE:
|
||||||
|
Loading…
Reference in New Issue
Block a user