add cache storage placeholder
This commit is contained in:
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
/**
|
||||||
|
* This file is part of Hyperf.
|
||||||
|
*
|
||||||
|
* @link https://www.hyperf.io
|
||||||
|
* @document https://hyperf.wiki
|
||||||
|
* @contact group@hyperf.io
|
||||||
|
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Storage;
|
||||||
|
|
||||||
|
use bandwidthThrottle\tokenBucket\storage\scope\GlobalScope;
|
||||||
|
use bandwidthThrottle\tokenBucket\storage\Storage;
|
||||||
|
use Hyperf\RateLimit\Storage\StorageInterface;
|
||||||
|
use Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
|
class EmptyStorage implements StorageInterface, Storage, GlobalScope
|
||||||
|
{
|
||||||
|
public function __construct(ContainerInterface $container, string $key, int $timeout, array $options = [])
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMutex()
|
||||||
|
{
|
||||||
|
return new class {
|
||||||
|
public function check($callback)
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function then($callback)
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isBootstrapped()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bootstrap($microtime)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function remove()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMicrotime($microtime)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function letMicrotimeUnchanged()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMicrotime()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Hyperf\RateLimit\Storage\StorageInterface;
|
||||||
|
use Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
|
class MemoryTableStorage implements StorageInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
// @TODO 使用 https://wiki.swoole.com/zh-cn/#/memory/table 创建限流的缓存系统
|
||||||
|
public function __construct(ContainerInterface $container, string $key, int $timeout, array $options = [])
|
||||||
|
{
|
||||||
|
throw new \Exception('Not implemented');
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user