Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
lohanidamodar committed Mar 12, 2024
1 parent 126cadf commit ed30e8a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Abuse/Adapters/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function check(): bool
public function getLogs(?int $offset = null, ?int $limit = 25): array
{
// TODO limit potential is SCAN but needs cursor no offset
return $this->redis->keys(self::NAMESPACE . ':*');
return $this->redis->keys(self::NAMESPACE . ':*');
}

/**
Expand All @@ -172,16 +172,17 @@ public function getLogs(?int $offset = null, ?int $limit = 25): array
public function cleanup(string $datetime): bool
{
// TODO
$iterator = NULL;
while($iterator !== 0) {
$iterator = null;
while ($iterator !== 0) {
$keys = $this->redis->scan($iterator, self::NAMESPACE . ':*:*', 1000);
$keys = $this->filterKeys($keys, $datetime);
$this->redis->del($keys);
}
return true;
}

protected function filterKeys(array $keys, int $timestamp): array {
protected function filterKeys(array $keys, int $timestamp): array
{
$filteredKeys = [];
foreach ($keys as $key) {
$parts = explode(':', $key);
Expand All @@ -192,6 +193,4 @@ protected function filterKeys(array $keys, int $timestamp): array {
}
return $filteredKeys;
}


}
}

0 comments on commit ed30e8a

Please sign in to comment.