Conditions | 1 |
Paths | 1 |
Total Lines | 20 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
36 | public function process(): int |
||
37 | { |
||
38 | $script = <<<LUA |
||
39 | local limit, timestamp = ... |
||
40 | local counter = 0 |
||
41 | box.begin() |
||
42 | box.space.$this->space.index.expire:pairs() |
||
43 | :take_while(function(tuple) return counter < limit end) |
||
44 | :take_while(function(tuple) return tuple.expire <= timestamp end) |
||
45 | :each(function(tuple) |
||
46 | box.space.$this->space:delete( tuple.key ) |
||
47 | counter = counter + 1 |
||
48 | end) |
||
49 | box.commit() |
||
50 | return counter |
||
51 | LUA; |
||
52 | |||
53 | [$counter] = $this->client->evaluate($script, $this->limit, microtime(true)); |
||
54 | |||
55 | return $counter; |
||
56 | } |
||
58 |