Maximiliano Schvindt 6 лет назад
Родитель
Сommit
f0ea0beb0e
1 измененных файлов с 19 добавлено и 0 удалено
  1. 19 0
      Services/RedisService.php

+ 19 - 0
Services/RedisService.php

@@ -164,4 +164,23 @@ class RedisService extends Redis implements CollectorInterface
         return array();
     }
 
+    /**
+     * @param string $key
+     */
+    public function hgetall($key, $output = false)
+    {
+        $start = microtime(true);
+        $_data = parent::hgetall($key);
+        $end = microtime(true);
+        $t = $end - $start;
+        if ($output) {
+            print_r("HGET '{$key}': {$t} segundos" . PHP_EOL);
+        }
+
+        if($_data) 
+            return json_decode($_data,true);
+        
+        return array();
+    }
+
 }