Skip to content

Commit

Permalink
DDEV-1965 change wipeStorage to del in while loops
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadim Davydenko committed Nov 15, 2024
1 parent 5adef6f commit 2cc78b8
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions src/Storage/OctaneCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,17 +452,31 @@ private function collectCounters(): array
*/
public function wipeStorage(): void
{
$this->gauges->destroy();
$this->gaugeValues->destroy();
$this->clearTable($this->gauges);
$this->clearTable($this->gaugeValues);

$this->сounters->destroy();
$this->сounterValues->destroy();
$this->clearTable($this->сounters);
$this->clearTable($this->сounterValues);

$this->summaries->destroy();
$this->summaryValues->destroy();
$this->clearTable($this->summaries);
$this->clearTable($this->summaryValues);

$this->histograms->destroy();
$this->histogramValues->destroy();
$this->clearTable($this->histograms);
$this->clearTable($this->histogramValues);
}

/**
* @param Table $table
* @return void
*/
private function clearTable(Table $table): void
{
$table->rewind();
while ($table->valid())
{
$table->del($table->key());
$table->next();
}
}

/**
Expand Down

0 comments on commit 2cc78b8

Please sign in to comment.