This commit is contained in:
2021-02-22 18:29:41 +08:00
parent f2b95ae21d
commit 33c0454b49
+7 -15
View File
@@ -24,14 +24,6 @@ class File extends Component implements ICache
{ {
public string $path; public string $path;
/**
* @throws Exception
*/
public function init()
{
parent::init(); // TODO: Change the autogenerated stub
}
/** /**
* @param $key * @param $key
* @param $val * @param $val
@@ -71,9 +63,9 @@ class File extends Component implements ICache
/** /**
* @param $key * @param $key
* @param array $val * @param array $val
* @return mixed * @return bool|int|string
*/ */
public function hMSet($key, array $val): mixed public function hMSet($key, array $val): bool|int|string
{ {
$hash = $this->get($key); $hash = $this->get($key);
if (!is_array($hash)) { if (!is_array($hash)) {
@@ -87,24 +79,24 @@ class File extends Component implements ICache
/** /**
* @param string $key * @param string $key
* @param string $hashKey * @param string $hashKey
* @return string|int|bool|null * @return string|int|bool
*/ */
public function hGet(string $key, string $hashKey): string|int|bool|null public function hGet(string $key, string $hashKey): string|int|bool
{ {
$hash = $this->get($key); $hash = $this->get($key);
if (!is_array($hash)) { if (!is_array($hash)) {
return false; return false;
} }
return $hash[$hashKey] ?? null; return $hash[$hashKey] ?? false;
} }
/** /**
* @param $key * @param $key
* @param $hashKey * @param $hashKey
* @param $hashValue * @param $hashValue
* @return mixed * @return bool|int|string
*/ */
public function hSet($key, $hashKey, $hashValue): mixed public function hSet($key, $hashKey, $hashValue): bool|int|string
{ {
$hash = $this->get($key); $hash = $this->get($key);
if (!is_array($hash)) { if (!is_array($hash)) {