Skip to content

Commit c7dedf1

Browse files
author
Mauro Cassani
committed
Fix ApcuRepository
1 parent 30614b8 commit c7dedf1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/InMemoryList/Infrastructure/Persistance/ApcuRepository.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ private function addOrUpdateListToIndex($listUuid, $size, $numberOfChunks, $chun
214214
]);
215215

216216
$indexArrayToUpdate[(string) $listUuid] = $indexArray;
217+
$index = apcu_fetch((string) $indexKey);
217218

218-
if ($this->existsListInIndex($listUuid)) {
219-
$index = apcu_fetch((string) $indexKey);
219+
if ($this->existsListInIndex($listUuid) or is_array($index)) {
220220
$index[$listUuid] = $indexArray;
221221
$indexArrayToUpdate = $index;
222222
apcu_delete($indexKey);

tests/InMemoryList/Infrastructure/Persistence/RepositoryTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function setUp()
5050
$pdo = new \PDO($dsn, $pdo_parameters['username'], $pdo_parameters['password']);
5151

5252
$this->repos = [
53-
// new ApcuRepository(),
53+
new ApcuRepository(),
5454
new MemcachedRepository($memcached),
5555
new PdoRepository($pdo, true),
5656
new RedisRepository(new Client($redis_parameters)),

0 commit comments

Comments
 (0)