Skip to content

Commit

Permalink
Don’t cache empty responses.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstein committed Sep 9, 2024
1 parent 04ad0bd commit f6a531d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion items.php
Original file line number Diff line number Diff line change
Expand Up @@ -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...');
}
Expand Down

0 comments on commit f6a531d

Please sign in to comment.