chore(*): remove duplicate cache rule + cleanup cache headers; cleanup + formatting
This commit is contained in:
parent
425fed6ff6
commit
0e565970a5
42 changed files with 223 additions and 217 deletions
|
@ -18,6 +18,7 @@ class LatestListenHandler extends BaseHandler
|
|||
{
|
||||
try {
|
||||
$cachedData = $this->cache ? $this->cache->get("latest_listen") : null;
|
||||
|
||||
if ($cachedData) {
|
||||
$this->sendResponse(json_decode($cachedData, true));
|
||||
return;
|
||||
|
@ -41,17 +42,14 @@ class LatestListenHandler extends BaseHandler
|
|||
$this->sendResponse($latestListen);
|
||||
} catch (\Exception $e) {
|
||||
error_log("LatestListenHandler Error: " . $e->getMessage());
|
||||
$this->sendErrorResponse(
|
||||
"Internal Server Error: " . $e->getMessage(),
|
||||
500
|
||||
);
|
||||
|
||||
$this->sendErrorResponse("Internal Server Error: " . $e->getMessage(), 500);
|
||||
}
|
||||
}
|
||||
|
||||
private function formatLatestListen(array $latestListen): array
|
||||
{
|
||||
$emoji =
|
||||
$latestListen["artist_emoji"] ?? ($latestListen["genre_emoji"] ?? "🎧");
|
||||
$emoji = $latestListen["artist_emoji"] ?? ($latestListen["genre_emoji"] ?? "🎧");
|
||||
$trackName = htmlspecialchars(
|
||||
$latestListen["track_name"] ?? "Unknown Track",
|
||||
ENT_QUOTES,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue