Debian Codegraph @

lib/3rdParty/composer/symfony/http-foundation/RateLimiter/PeekableRequestRateLimiterInterface.php

raw symbols SCIP
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\HttpFoundation\RateLimiter;
13
14 use Symfony\Component\HttpFoundation\Request;
15 use Symfony\Component\RateLimiter\RateLimit;
16
17 /**
18 * A request limiter which allows peeking ahead.
19 *
20 * This is valuable to reduce the cache backend load in scenarios
21 * like a login when we only want to consume a token on login failure,
22 * and where the majority of requests will be successful and thus not
23 * need to consume a token.
24 *
25 * This way we can peek ahead before allowing the request through, and
26 * only consume if the request failed (1 backend op). This is compared
27 * to always consuming and then resetting the limit if the request
28 * is successful (2 backend ops).
29 *
30 * @author Jordi Boggiano <[email protected]>
31 */
32 interface PeekableRequestRateLimiterInterface extends RequestRateLimiterInterface
33 {
34 public function peek(Request $request): RateLimit;
35 }