mirror of
https://gitee.com/ctexthuang/hyperf_rbac_framework_server_ctexthuang.git
synced 2025-12-25 18:17:49 +08:00
fix : readme update
This commit is contained in:
@@ -163,7 +163,7 @@ abstract class BaseScript
|
||||
];
|
||||
|
||||
$logStrategy = match(true) {
|
||||
!$success => $this->logger->cache()->error(...),
|
||||
!$success => $this->logger->error()->error(...),
|
||||
$this->debugMode => $this->logger->cache()->debug(...),
|
||||
default => fn() => null // 不记录
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Cache\Redis;
|
||||
|
||||
use App\Cache\Redis\Lua\RateLimit;
|
||||
use App\Lib\Log\Logger;
|
||||
use Hyperf\Contract\ConfigInterface;
|
||||
use Hyperf\Redis\RedisFactory;
|
||||
@@ -9,6 +10,7 @@ use Hyperf\Redis\RedisProxy;
|
||||
|
||||
/**
|
||||
* @mixin RedisProxy
|
||||
* @template T
|
||||
*/
|
||||
class RedisCache
|
||||
{
|
||||
@@ -53,10 +55,11 @@ class RedisCache
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $scriptClass
|
||||
* @return mixed
|
||||
* @template TReturn
|
||||
* @param class-string<TReturn> $scriptClass
|
||||
* @return TReturn
|
||||
*/
|
||||
public function lua(string $scriptClass): mixed
|
||||
public function lua(string $scriptClass)
|
||||
{
|
||||
$poolName = $this->poolName ?? 'default';
|
||||
$key = $poolName . ':' . $scriptClass;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Common\Trait;
|
||||
|
||||
use App\Cache\Redis\Lua\RateLimit;
|
||||
use App\Cache\Redis\RedisCache;
|
||||
use App\Cache\Redis\RedisKey;
|
||||
use App\Common\Repository\AdminUserRepository;
|
||||
@@ -34,7 +35,7 @@ trait AdminUserTrait
|
||||
if (Context::has($key)) {
|
||||
return Context::get($key,false);
|
||||
}
|
||||
|
||||
$this->redis->with()->lua(RateLimit::class)->check();
|
||||
if ($this->redis->with()->exists($key)) {
|
||||
$userInfo = unserialize($this->redis->with()->get($key));
|
||||
Context::set($key,$userInfo);
|
||||
|
||||
Reference in New Issue
Block a user