This commit is contained in:
xl
2023-05-26 11:16:45 +08:00
parent 37bbb14fdb
commit 5b27d5c07e
4 changed files with 14 additions and 71 deletions
+2 -2
View File
@@ -931,9 +931,9 @@ if (!function_exists('config')) {
/**
* @param $key
* @param null $default
* @return array|string|int|float|bool|null
* @return mixed
*/
function config($key, $default = NULL): null|array|string|int|float|bool
function config($key, $default = NULL): mixed
{
return make(ConfigProvider::class)->get($key, $default);
}
+3 -3
View File
@@ -24,10 +24,10 @@ class ConfigProvider
/**
* @param string $key
* @param int|string|bool|array|null $default
* @return int|string|bool|array|null
* @param mixed $default
* @return mixed
*/
public function get(string $key, int|string|bool|null|array $default = null): int|string|bool|null|array
public function get(string $key, mixed $default = null): mixed
{
$keys = explode('.', $key);
-65
View File
@@ -1,65 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: whwyy
* Date: 2018/11/8 0008
* Time: 16:35
*/
declare(strict_types=1);
namespace Kiri\Redis;
/**
* Interface ICache
* @package Kiri\Cache
*/
interface CacheInterface
{
/**
* @param $key
* @param $val
* @return string|int
*/
public function set($key, $val): string|int;
/**
* @param $key
* @return string|int|bool
*/
public function get($key): mixed;
/**
* @param $key
* @param array $hashKeys
* @return array|bool|null
*/
public function hMGet($key, array $hashKeys): array|bool|null;
/**
* @param $key
* @param array $val
* @return mixed
*/
public function hMSet($key, array $val): mixed;
/**
* @param string $key
* @param string $hashKey
* @return string|int|bool
*/
public function hGet(string $key, string $hashKey): string|int|bool;
/**
* @param $key
* @param $hashKey
* @param $hashValue
* @return mixed
*/
public function hSet($key, $hashKey, $hashValue): mixed;
/**
* @param $key
* @return bool
*/
public function exists($key): bool;
}
+9 -1
View File
@@ -30,7 +30,7 @@ use ReflectionException;
* @package Kiri\Cache
* @mixin \Redis
*/
class Redis extends Component
class Redis
{
public string $host = '';
@@ -57,6 +57,14 @@ class Redis extends Component
public array $pool = ['min' => 1, 'max' => 100];
/**
* 初始化
*/
public function __construct()
{
Kiri::configure($this, \config('redis', []));
}
/**
* @return void
* @throws Exception