From f6a531db447e02139e6421f0a5a3cbde788e9652 Mon Sep 17 00:00:00 2001 From: Matt Stein Date: Mon, 9 Sep 2024 12:35:06 -0700 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20cache=20empty=20responses.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ items.php | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff46c4b..5cd5c66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.0.2] - 2024-09-09 + +### Changed + +- Stopped caching empty API responses. + ## [0.0.1] - 2024-09-09 ### Added diff --git a/items.php b/items.php index 9946d05..9c29bd7 100644 --- a/items.php +++ b/items.php @@ -28,7 +28,10 @@ 'saved' => $now, ]; - $workflow->cache()->writeJson($data); + if (! empty($data->servers) || ! empty($data->projects)) { + // Only cache non-empty responses + $workflow->cache()->writeJson($data); + } } else { $workflow->logger()->info('Using cached data...'); }