Skip to content

Commit f7c6567

Browse files
committed
WIP
1 parent 19b0f8d commit f7c6567

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

src/Federation/EntityCollection/CacheEntityCollectionStore.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function store(string $trustAnchorId, array $entities, int $ttl): void
3131
{
3232
try {
3333
$this->cacheDecorator->set(
34-
$this->helpers->json()->encode($entities),
34+
$entities,
3535
$ttl,
3636
self::KEY_FEDERATED_ENTITIES,
3737
$trustAnchorId,
@@ -52,21 +52,14 @@ public function store(string $trustAnchorId, array $entities, int $ttl): void
5252
public function get(string $trustAnchorId): ?array
5353
{
5454
try {
55-
/** @var ?string $cached */
5655
$cached = $this->cacheDecorator->get(null, self::KEY_FEDERATED_ENTITIES, $trustAnchorId);
5756

58-
if (is_null($cached)) {
57+
if (!is_array($cached)) {
5958
return null;
6059
}
6160

62-
$decoded = $this->helpers->json()->decode($cached);
63-
64-
if (!is_array($decoded)) {
65-
return null;
66-
}
67-
68-
/** @var array<string, array<string, mixed>> $decoded */
69-
return $decoded;
61+
/** @var array<string, array<string, mixed>> $cached */
62+
return $cached;
7063
} catch (Throwable $throwable) {
7164
$this->logger?->error('Unable to retrieve entities from cache.', [
7265
'trustAnchorId' => $trustAnchorId,

0 commit comments

Comments
 (0)