CacheStorage example

'reset' => '5 minutes',
            'limits' => [
                [
                    'limit' => 3,
                    'interval' => '10 seconds',
                ],
            ],
        ];

        $factory = new RateLimiterFactory(
            $config,
            new CacheStorage(new ArrayAdapter()),
            $this->createMock(SystemConfigService::class),
            $this->createMock(LockFactory::class),
        );

        static::assertInstanceOf(NoLimiter::class$factory->create('example'));
    }

    public function testRateLimitNewsletterForm(): void
    {
        for ($i = 0; $i <= 3; ++$i) {
            $this->browser
                

                    'limit' => 7,
                    'interval' => '60 seconds',
                ],
            ],
        ];

        $this->id = $this->config['id'] . '-test';

        $factory = new RateLimiterFactory(
            $this->config,
            new CacheStorage(new ArrayAdapter()),
            $this->createMock(SystemConfigService::class),
            $this->createMock(LockFactory::class)
        );

        $this->limiter = $factory->create('example');
        $this->limiter->reset();

        $this->getContainer()->get('cache.rate_limiter')->clear();
    }

    public function testConsume(): void
    {
Home | Imprint | This part of the site doesn't use cookies.