v7.0.0-beta.2 release
This commit is contained in:
1 parent
6595fd0eb5
commit
fa8eba7a0d
1165 files changed
+107118
-762127
No files matched your search
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\Public;
|
||||
|
||||
use App\Contracts\Extension\CacheInterface;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Seo\SitemapGenerator;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
/**
|
||||
* Sitemap XML 컨트롤러
|
||||
@@ -21,20 +21,21 @@ class SitemapController extends Controller
|
||||
* 캐시가 있으면 캐시된 XML, 없으면 실시간 생성 후 캐시 저장.
|
||||
*
|
||||
* @param SitemapGenerator $generator Sitemap 생성기
|
||||
* @param CacheInterface $cache 코어 캐시 드라이버
|
||||
*/
|
||||
public function index(SitemapGenerator $generator): Response
|
||||
public function index(SitemapGenerator $generator, CacheInterface $cache): Response
|
||||
{
|
||||
$enabled = (bool) g7_core_settings('seo.sitemap_enabled', true);
|
||||
if (! $enabled) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$xml = Cache::get('seo:sitemap');
|
||||
$xml = $cache->get('seo.sitemap');
|
||||
|
||||
if (! $xml) {
|
||||
$xml = $generator->generate();
|
||||
$ttl = (int) g7_core_settings('seo.sitemap_cache_ttl', 86400);
|
||||
Cache::put('seo:sitemap', $xml, $ttl);
|
||||
$ttl = (int) g7_core_settings('cache.seo_sitemap_ttl', g7_core_settings('seo.sitemap_cache_ttl', 86400));
|
||||
$cache->put('seo.sitemap', $xml, $ttl);
|
||||
}
|
||||
|
||||
return response($xml, 200, [
|
||||
|
||||
Reference in new issue
Block a user