Files
citrus-cms/resources/views/cron/slow-page-cache.blade.php
T
2026-04-28 21:15:09 +03:00

40 lines
1.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// General View Cache Generator
// Bu cron görevi, belirtilen blade viewlarını önbelleğe alır ve storage/app/cache/ dizinine kaydeder
/*
use Illuminate\Support\Facades\Storage;
// Cache klasörünü oluştur (yoksa)
if (!Storage::exists('cache')) {
Storage::makeDirectory('cache');
}
// Önbelleğe alınacak view'ların listesi
$viewsToCache = [
'admin.dashboard.module.dashboard' => 'dashboard',
'admin.type.summary-nocache' => 'summary',
// Burada daha fazla view ekleyebilirsiniz
// 'view.path' => 'cache_filename'
];
// Her bir view için önbellek oluştur
foreach ($viewsToCache as $viewPath => $cacheFileName) {
try {
// View içeriğini oluştur
$viewContent = view($viewPath)->render();
// Cache dosyasını kaydet
Storage::put("cache/{$cacheFileName}.blade.php", $viewContent);
// Son güncelleme zamanını kaydet
Storage::put("cache/{$cacheFileName}_last_updated.txt", date('Y-m-d H:i:s'));
echo "{$viewPath} önbelleği başarıyla güncellendi: " . date('Y-m-d H:i:s') . "<br>";
} catch (\Exception $e) {
echo "{$viewPath} önbelleği güncellenirken hata oluştu: " . $e->getMessage() . "<br>";
}
}
echo "Tüm önbellekler güncellendi: " . date('Y-m-d H:i:s');
*/
?>