新增滑动窗口限流

This commit is contained in:
JaguarJack
2020-07-02 17:28:01 +08:00
parent 349f36df21
commit 5e076a6eb7
2 changed files with 71 additions and 1 deletions

View File

@@ -14,9 +14,18 @@ use think\facade\Cache;
trait Redis
{
/**
* @var \Redis
*/
protected $redis = null;
protected function getRedis()
/**
* 返回 redis
*
* @time 2020年07月02日
* @return \Redis
*/
protected function getRedis(): \Redis
{
if (!$this->redis) {
$this->redis = Cache::store('redis')->handler();