Skip to content

Commit 13b20f7

Browse files
committed
use cache
1 parent c409c8b commit 13b20f7

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/Tqdev/PhpCrudUi/Column/SpecificationService.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ private function getDefinition(): array
2525
if ($data) {
2626
$result = json_decode(gzuncompress($data), true);
2727
} else {
28-
$result = $this->api->getOpenApi()?:[];
29-
$data = gzcompress(json_encode($result));
30-
$this->cache->set('Definition', $data, $this->ttl);
28+
$result = $this->api->getOpenApi();
29+
if ($result) {
30+
$data = gzcompress(json_encode($result));
31+
$this->cache->set('Definition', $data, $this->ttl);
32+
} else {
33+
$result = [];
34+
}
3135
}
3236
return $result;
3337
}

ui.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -10357,9 +10357,13 @@ private function getDefinition(): array
1035710357
if ($data) {
1035810358
$result = json_decode(gzuncompress($data), true);
1035910359
} else {
10360-
$result = $this->api->getOpenApi()?:[];
10361-
$data = gzcompress(json_encode($result));
10362-
$this->cache->set('Definition', $data, $this->ttl);
10360+
$result = $this->api->getOpenApi();
10361+
if ($result) {
10362+
$data = gzcompress(json_encode($result));
10363+
$this->cache->set('Definition', $data, $this->ttl);
10364+
} else {
10365+
$result = [];
10366+
}
1036310367
}
1036410368
return $result;
1036510369
}

0 commit comments

Comments
 (0)