protected function PhpRedis::garbageCollection in Redis 8
Same name in this branch
- 8 src/Flood/PhpRedis.php \Drupal\redis\Flood\PhpRedis::garbageCollection()
- 8 src/Queue/PhpRedis.php \Drupal\redis\Queue\PhpRedis::garbageCollection()
Automatically release items, that have been claimed and exceeded lease time.
1 call to PhpRedis::garbageCollection()
- PhpRedis::claimItem in src/
Queue/ PhpRedis.php - Claims an item in the queue for processing.
File
- src/
Queue/ PhpRedis.php, line 139
Class
- PhpRedis
- Redis queue implementation using PhpRedis extension backend.
Namespace
Drupal\redis\QueueCode
protected function garbageCollection() {
foreach ($this->client
->lrange($this->claimedListKey, 0, -1) as $qid) {
if (!$this->client
->exists($this->leasedKeyPrefix . $qid)) {
// The lease expired for this ID.
$this->client
->lrem($this->claimedListKey, $qid, -1);
$this->client
->lpush($this->availableListKey, $qid);
}
}
}