From 71adeffc32b28309406602d27544449ebce97e35 Mon Sep 17 00:00:00 2001 From: liugang Date: Thu, 24 Oct 2024 15:09:19 +0800 Subject: [PATCH] * [perf] rename methods to fetch cache from redis. --- lib/base/cache/cache.class.php | 4 ++-- lib/zredis/zredis.class.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/base/cache/cache.class.php b/lib/base/cache/cache.class.php index 84547bf62d..cdfe40c897 100644 --- a/lib/base/cache/cache.class.php +++ b/lib/base/cache/cache.class.php @@ -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 = []; diff --git a/lib/zredis/zredis.class.php b/lib/zredis/zredis.class.php index b4bc9992ed..f2dc4564fc 100644 --- a/lib/zredis/zredis.class.php +++ b/lib/zredis/zredis.class.php @@ -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 = [];