* [perf] rename methods to fetch cache from redis.

This commit is contained in:
liugang
2024-11-20 15:42:49 +08:00
committed by 朱金勇
parent 6cfdbae44e
commit 71adeffc32
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -481,7 +481,7 @@ class baseCache
*/
public function fetch($field = '')
{
$rawResult = $this->app->redis->getObjects($this->table);
$rawResult = $this->app->redis->fetchAll($this->table);
if(empty($rawResult)) return '';
foreach($rawResult as $row)
@@ -505,7 +505,7 @@ class baseCache
*/
public function fetchAll($keyField = 0)
{
$rawResult = $this->app->redis->getObjects($this->table);
$rawResult = $this->app->redis->fetchAll($this->table);
if(empty($rawResult)) return [];
$result = [];
+4 -4
View File
@@ -264,7 +264,7 @@ class zredis
* @access public
* @return object
*/
public function getObject(string $table, int|string $key)
public function fetch(string $table, int|string $key)
{
if(empty($this->redis)) return $this->log('Redis is not initialized.');
if(empty($table)) return $this->log('Table name is required.');
@@ -287,7 +287,7 @@ class zredis
* @access public
* @return array
*/
public function getObjects(string $table, array $keyList = [])
public function fetchAll(string $table, array $keyList = [])
{
if(empty($this->redis)) return $this->log('Redis is not initialized.');
if(empty($table)) return $this->log('Table name is required.');
@@ -318,7 +318,7 @@ class zredis
* @access public
* @return array
*/
public function getPairs(string $table, string $key, string $value, array $keyList = [])
public function fetchPairs(string $table, string $key, string $value, array $keyList = [])
{
if(empty($this->redis)) return $this->log('Redis is not initialized.');
if(empty($table)) return $this->log('Table name is required.');
@@ -326,7 +326,7 @@ class zredis
if(empty($value)) return $this->log('Value is required.');
if(empty($this->config->redis->caches[$table])) return $this->log('No cache settings for table ' . $table);
$objects = $this->getObjects($table, $keyList);
$objects = $this->fetchAll($table, $keyList);
if(!$objects) return [];
$paris = [];