Explorar el Código

Se actualiza servicio de redis

Maxi Schvindt hace 6 años
padre
commit
e7ac03ffd8
Se han modificado 1 ficheros con 20 adiciones y 0 borrados
  1. 20 0
      Services/RedisService.php

+ 20 - 0
Services/RedisService.php

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