Skip to content

Commit

Permalink
Update: 修复代码
Browse files Browse the repository at this point in the history
  • Loading branch information
NHZEX committed Feb 19, 2024
1 parent ecb4432 commit cc54c3f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Components/redis/src/RedisManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public static function getNewInstance(?string $poolName = null): IRedisHandler
$manager = ConnectionCenter::getConnectionManager($poolName);

/** @var IRedisHandler $instance */
return $manager->getDriver()->createInstance();
$instance = $manager->getDriver()->createInstance();

return $instance;
}

/**
Expand All @@ -45,7 +47,9 @@ public static function getInstance(?string $poolName = null): IRedisHandler
$connection = ConnectionCenter::getRequestContextConnection($poolName);

/** @var IRedisHandler $instance */
return $connection->getInstance();
$instance = $connection->getInstance();

return $instance;
}

/**
Expand All @@ -61,11 +65,13 @@ public static function use(?string $poolName, callable $callable): mixed
{
$connection = ConnectionCenter::getConnection($poolName);

return $callable($connection->getInstance());
return $callable($connection, $connection->getInstance());
}
else
{
return $callable(static::getInstance($poolName));
$connection = ConnectionCenter::getRequestContextConnection($poolName);

return $callable($connection, $connection->getInstance());
}
}

Expand Down

0 comments on commit cc54c3f

Please sign in to comment.