|
@@ -120,4 +120,28 @@ class RedisService extends Redis implements CollectorInterface
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @param string $key
|
|
|
+ * @param string $field
|
|
|
+ * @param array $data
|
|
|
+ */
|
|
|
+ public function hset($key, $field, $data, $output = false)
|
|
|
+ {
|
|
|
+ $start = microtime(true);
|
|
|
+ $_save = json_encode($data);
|
|
|
+ $end = microtime(true);
|
|
|
+ $t = $end - $start;
|
|
|
+ if ($output) {
|
|
|
+ print_r("ENCODE key '{$key}.{$field}': {$t} segundos" . PHP_EOL);
|
|
|
+ }
|
|
|
+
|
|
|
+ $start = microtime(true);
|
|
|
+ parent::hset($key, $field, $_save);
|
|
|
+ $end = microtime(true);
|
|
|
+ $t = $end - $start;
|
|
|
+ if ($output) {
|
|
|
+ print_r("SETEX key '{$key}.{$field}': {$t} segundos" . PHP_EOL);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|