Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"illuminate/contracts": "11.*|12.*"
},
"require-dev": {
"orchestra/testbench": "9.*|10.*"
"orchestra/testbench": "^9.16|10.*"
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 6 additions & 1 deletion src/Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Illuminate\Support\Str;

use function app;
use function array_filter;
use function array_shift;
use function is_array;
use function max;
Expand Down Expand Up @@ -159,7 +160,11 @@ protected function retrieveResultsFromCache(string $key): array
return [$key => null, $this->cache->key => null];
}

return $this->repository->getMultiple([$key, $this->cache->key]);
$result = $this->repository->getMultiple(array_filter([$key, $this->cache->key]));

$result[$this->cache->key] ??= null;

return $result;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions tests/ProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public function test_uses_custom_time_to_live(): void
$interval = $now->diffAsCarbonInterval(now());

$repository = $this->mock(Repository::class);
$repository->expects('getMultiple')->with([$hash, ''])->times(4)->andReturn(['' => null, $hash => null]);
$repository->expects('getMultiple')->with([$hash])->times(4)->andReturn(['' => null, $hash => null]);
$repository->allows('getStore')->never();
$repository->expects('put')->with($hash, Mockery::type('array'), null);
$repository->expects('put')->with($hash, Mockery::type('array'), $seconds);
Expand Down Expand Up @@ -560,7 +560,7 @@ public function test_uses_custom_store(): void
$repository = $this->mock(Repository::class);
$repository->expects('flexible')->never();
$repository->expects('put')->with($hash, Mockery::type('array'), 60)->once();
$repository->expects('getMultiple')->with([$hash, ''])->times(1)->andReturn(['' => null, $hash => null]);
$repository->expects('getMultiple')->with([$hash])->times(1)->andReturn(['' => null, $hash => null]);

$this->mock('cache')->expects('store')->with('test-store')->andReturn($repository);

Expand Down Expand Up @@ -630,7 +630,7 @@ public function test_doesnt_uses_flexible_caching_if_repository_is_not_flexible(
$repository = $this->mock(Repository::class);
$repository->expects('flexible')->never();
$repository->expects('put')->with($hash, Mockery::type('array'), [5, 300])->once();
$repository->expects('getMultiple')->with([$hash, ''])->times(1)->andReturn(['' => null, $hash => null]);
$repository->expects('getMultiple')->with([$hash])->times(1)->andReturn(['' => null, $hash => null]);

$this->mock('cache')->expects('store')->with(null)->andReturn($repository);

Expand Down Expand Up @@ -921,7 +921,7 @@ public function test_base_query_uses_cache_callback(): void
$repository = $this->mock(Repository::class);
$repository->expects('flexible')->never();
$repository->expects('put')->with($hash, Mockery::type('array'), [5, 300])->once();
$repository->expects('getMultiple')->with([$hash, ''])->times(1)->andReturn(['' => null, $hash => null]);
$repository->expects('getMultiple')->with([$hash])->times(1)->andReturn(['' => null, $hash => null]);

$this->mock('cache')->expects('store')->with(null)->andReturn($repository);

Expand Down