Skip to content

Commit 4f72e8d

Browse files
committed
Reduce stampeding effect
1 parent 636fc26 commit 4f72e8d

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Note: you may refer to `README.md` for description of features.
33

44
## Dev (WIP)
5+
- Added slight delays in the file & database evictor to reduce cache stampeding
56
- Fixed inaccurate "directories removed" statistics for the file evictor
67

78
## 2.0.8 (2025-10-04)

src/Database/DatabaseEvictStrategy.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ public function execute(): void
9494
// items really expired with no new updates
9595
$this->deletedRecords += $rowsAffected;
9696
}
97+
98+
// reduce stampeding
99+
usleep(1000);
97100
}
98101

99102
// report results:

src/File/FileEvictStrategy.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ public function execute(): void
7070
if (@rmdir($localPath)) {
7171
$this->deletedDirs++;
7272
}
73+
74+
// reduce stampeding
75+
usleep(1000);
7376
}
7477

7578
$progressBar->finish();

0 commit comments

Comments
 (0)