protected function Predis::garbageCollection in Redis 8
Same name in this branch
- 8 src/Flood/Predis.php \Drupal\redis\Flood\Predis::garbageCollection()
- 8 src/Queue/Predis.php \Drupal\redis\Queue\Predis::garbageCollection()
Automatically release items, that have been claimed and exceeded lease time.
1 call to Predis::garbageCollection()
- Predis::claimItem in src/
Queue/ Predis.php - Claims an item in the queue for processing.
File
- src/
Queue/ Predis.php, line 140
Class
- Predis
- Redis queue implementation using Predis library 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);
}
}
}