| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 29 | public function write(array $items, string $namespace, callable $putItem): void |
||
| 30 | { |
||
| 31 | $processedCount = 0; |
||
| 32 | $itemCount = count($items); |
||
| 33 | |||
| 34 | while ($processedCount < $itemCount) { |
||
| 35 | $batchItems = array_slice($items, $processedCount, $this->batchSize); |
||
| 36 | foreach ($batchItems as $item) { |
||
| 37 | CacheDatabaseHelper::validateCacheItem($item); |
||
| 38 | $cacheKey = $item['cacheKey']; |
||
| 39 | $cacheData = $item['cacheData']; |
||
| 40 | $mergedData = CacheDatabaseHelper::mergeCacheData($cacheData); |
||
| 41 | $putItem($cacheKey, $mergedData, $namespace); |
||
| 42 | } |
||
| 43 | $processedCount += count($batchItems); |
||
| 44 | } |
||
| 47 |