Proje: Okul Platform · Hub: Okul Platform — Conventions
Cache Decorator Pattern
app/Repositories/Decorators/Cache/ConfigRepositoryCacheDecorator.php
Şu an sadece Config repository için mevcut. Potansiyel genişleme noktası.
Örnek
class ConfigRepositoryCacheDecorator extends ConfigRepository
{
public function dealCauseOfReasons(): Collection
{
return cache()->remember(
Config::DEAL_CAUSE_OF_REASON_KEY,
now()->addDay(),
fn() => parent::dealCauseOfReasons()
);
}
public function allowedLeadStages(): Collection
{
return cache()->remember(
'config_decorator_allowed_lead_stages',
now()->addDay(),
fn() => parent::allowedLeadStages()
);
}
}Cache Süresi
- Config verileri: 24 saat (addDay())
- Test ID’leri (ConfigService): 24 saat
Cache Driver
phpunit.xml’de test ortamında CACHE_STORE=array (in-memory).
Üretimde Redis kullanılıyor (Horizon ile aynı Redis).
Diğer Cache Kullanımları
ConfigService::prepareTestIds()— Test ID’leri 24 saat cacheSchool::SCHOOL_PROFILE_CACHE_KEY— Okul profil cache
Related
- api-repository-pattern — Repository yapısı
- api-config-system — Config cache kullanımı