Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bbd6f76

Browse filesBrowse files
committed
Remove all refs to $cached
1 parent 9988272 commit bbd6f76
Copy full SHA for bbd6f76

File tree

Expand file treeCollapse file tree

2 files changed

+1
-9
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+1
-9
lines changed

‎src/Symfony/Component/RateLimiter/Policy/SlidingWindow.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/RateLimiter/Policy/SlidingWindow.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ final class SlidingWindow implements LimiterStateInterface
4343
*/
4444
private $windowEndAt;
4545

46-
/**
47-
* @var bool true if this window has been cached
48-
*/
49-
private $cached = true;
50-
5146
public function __construct(string $id, int $intervalInSeconds)
5247
{
5348
if ($intervalInSeconds < 1) {
@@ -56,7 +51,6 @@ public function __construct(string $id, int $intervalInSeconds)
5651
$this->id = $id;
5752
$this->intervalInSeconds = $intervalInSeconds;
5853
$this->windowEndAt = microtime(true) + $intervalInSeconds;
59-
$this->cached = false;
6054
}
6155

6256
public static function createFromPreviousWindow(self $window, int $intervalInSeconds): self
@@ -77,8 +71,6 @@ public static function createFromPreviousWindow(self $window, int $intervalInSec
7771
*/
7872
public function __sleep(): array
7973
{
80-
// $cached is not serialized, it should only be set
81-
// upon first creation of the window.
8274
return ['id', 'hitCount', 'intervalInSeconds', 'hitCountForLastWindow', 'windowEndAt'];
8375
}
8476

‎src/Symfony/Component/RateLimiter/Tests/Policy/SlidingWindowTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/RateLimiter/Tests/Policy/SlidingWindowTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testGetExpirationTime()
2929

3030
$data = serialize($window);
3131
$cachedWindow = unserialize($data);
32-
$this->assertNull($cachedWindow->getExpirationTime());
32+
$this->assertSame(2 * 10, $cachedWindow->getExpirationTime());
3333

3434
$new = SlidingWindow::createFromPreviousWindow($cachedWindow, 15);
3535
$this->assertSame(2 * 15, $new->getExpirationTime());

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.