|
@@ -42,6 +42,8 @@ class RedisService extends Redis implements CollectorInterface
|
|
|
parent::disconnect();
|
|
|
parent::quit();
|
|
|
|
|
|
+ if (is_null($data_cached)) $data_cached = array();
|
|
|
+
|
|
|
return $data_cached;
|
|
|
}
|
|
|
|
|
@@ -87,4 +89,21 @@ class RedisService extends Redis implements CollectorInterface
|
|
|
|
|
|
return $_data;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param string $key
|
|
|
+ * @param string $data
|
|
|
+ */
|
|
|
+ public function setString($key, $data, $output = false)
|
|
|
+ {
|
|
|
+ $_save = $data;
|
|
|
+
|
|
|
+ $start = microtime(true);
|
|
|
+ parent::setex($key, 3600, $_save);
|
|
|
+ $end = microtime(true);
|
|
|
+ $t = $end - $start;
|
|
|
+ if ($output) {
|
|
|
+ print_r("SETEX key '{$key}': {$t} segundos" . PHP_EOL);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|