|
@@ -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();
|
|
|
+ }
|
|
|
+
|
|
|
}
|