mirror of
https://gitee.com/ctexthuang/hyperf_rbac_framework_server_ctexthuang.git
synced 2025-12-25 15:57:50 +08:00
feat : common redis cache and common logger
This commit is contained in:
31
app/Cache/Redis/RedisProxyWrapper.php
Normal file
31
app/Cache/Redis/RedisProxyWrapper.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cache\Redis;
|
||||
|
||||
use Hyperf\Redis\RedisProxy;
|
||||
|
||||
class RedisProxyWrapper
|
||||
{
|
||||
public function __construct(
|
||||
protected readonly RedisProxy $redisProxy,
|
||||
protected string $poolName
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
* @param array $arguments
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call(string $method, array $arguments)
|
||||
{
|
||||
return $this->redisProxy->{$method}(...$arguments);
|
||||
}
|
||||
|
||||
public function lua(string $scriptClass)
|
||||
{
|
||||
// 这里实现你的 Lua 脚本逻辑
|
||||
$key = $this->poolName . ':' . $scriptClass;
|
||||
// 实际实现根据你的需求
|
||||
return $this->redisProxy->eval($scriptClass, 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user