feat: add last podcast from castopod

This commit is contained in:
2025-10-17 17:38:16 +04:00
parent b35dbde8c9
commit 0319fa20c3
9 changed files with 692 additions and 87 deletions
+20
View File
@@ -160,6 +160,26 @@ function callApiCached($cacheKey, $callable, $ttl = 900) {
return $data;
}
/**
* Helpers simples pour le cache générique
*/
function getFromCache($key) {
if (!defined('CACHE_ENABLED') || !CACHE_ENABLED) {
return null;
}
$cache = $GLOBALS['simple_api_cache'];
return $cache->get($key, []);
}
function saveToCache($key, $data, $ttl = null) {
if (!defined('CACHE_ENABLED') || !CACHE_ENABLED) {
return;
}
$ttl = $ttl ?? (defined('CACHE_DURATION') ? CACHE_DURATION : 3600);
$cache = $GLOBALS['simple_api_cache'];
$cache->set($key, [], $data, $ttl);
}
// Nettoyage automatique occasionnel
if (rand(1, 100) === 1) {
$GLOBALS['simple_api_cache']->cleanup();