Skip to content

Commit

Permalink
use cache
Browse files Browse the repository at this point in the history
  • Loading branch information
mevdschee committed Jul 23, 2019
1 parent c409c8b commit 13b20f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions src/Tqdev/PhpCrudUi/Column/SpecificationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ private function getDefinition(): array
if ($data) {
$result = json_decode(gzuncompress($data), true);
} else {
$result = $this->api->getOpenApi()?:[];
$data = gzcompress(json_encode($result));
$this->cache->set('Definition', $data, $this->ttl);
$result = $this->api->getOpenApi();
if ($result) {
$data = gzcompress(json_encode($result));
$this->cache->set('Definition', $data, $this->ttl);
} else {
$result = [];
}
}
return $result;
}
Expand Down
10 changes: 7 additions & 3 deletions ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -10357,9 +10357,13 @@ private function getDefinition(): array
if ($data) {
$result = json_decode(gzuncompress($data), true);
} else {
$result = $this->api->getOpenApi()?:[];
$data = gzcompress(json_encode($result));
$this->cache->set('Definition', $data, $this->ttl);
$result = $this->api->getOpenApi();
if ($result) {
$data = gzcompress(json_encode($result));
$this->cache->set('Definition', $data, $this->ttl);
} else {
$result = [];
}
}
return $result;
}
Expand Down

0 comments on commit 13b20f7

Please sign in to comment.