fix(core): 공개 템플릿 config 캐시 무효화 누락과 확장 캐시 삭제 경로 동종 결함 정비
공개 config.json 의 고정 캐시 키(template.config.{identifier})가 어떤 갱신
경로에서도 forget 되지 않아 template:update/cache-clear/비활성화/삭제 후에도
최대 1시간(TTL) 이전 manifest 로 응답되던 결함(공개 )을 수정한다.
- TemplateManager::clearTemplateCache 공개화 — config/components_manifest(두
변종)/현재 버전 routes·language 키 능동 forget, updateTemplate cleanup 호출
- forgetLayoutCacheKeys 가 편집기용 .with_source_meta 변종까지 삭제
- ext.cache_version 쓰기를 incrementExtensionCacheVersion 단일 지점으로 통일
- module/plugin:cache-clear 의 유령 키 forget 을 실재 캐시(레이아웃 서빙/해석
캐시, 상태 키, 미들웨어 인덱스, 버전 bump) 무효화로 교체
- 공개 routes/language/layout API 의 ?v 생략 폴백을 0 → 현재 버전으로 교정
This commit is contained in:
1 parent
09a700e4c7
commit
e819db9d42
27 files changed
+891
-247
No files matched your search
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Contracts\Extension\CacheInterface;
|
||||
use App\Contracts\Repositories\LayoutExtensionRepositoryInterface;
|
||||
use App\Contracts\Repositories\LayoutExtensionVersionRepositoryInterface;
|
||||
use App\Contracts\Repositories\LayoutRepositoryInterface;
|
||||
@@ -15,6 +14,7 @@ use App\Extension\HookManager;
|
||||
use App\Extension\ModuleManager;
|
||||
use App\Extension\PluginManager;
|
||||
use App\Extension\TemplateManager;
|
||||
use App\Extension\Traits\ClearsTemplateCaches;
|
||||
use App\Extension\Traits\ComputesLayoutContentHash;
|
||||
use App\Models\LayoutExtension;
|
||||
use App\Models\TemplateLayoutExtensionVersion;
|
||||
@@ -32,6 +32,7 @@ use Illuminate\Support\Facades\Log;
|
||||
*/
|
||||
class LayoutExtensionService
|
||||
{
|
||||
use ClearsTemplateCaches;
|
||||
use ComputesLayoutContentHash;
|
||||
|
||||
/**
|
||||
@@ -123,7 +124,6 @@ class LayoutExtensionService
|
||||
private LayoutExtensionRepositoryInterface $repository,
|
||||
private LayoutExtensionVersionRepositoryInterface $versionRepository,
|
||||
private LayoutRepositoryInterface $layoutRepository,
|
||||
private CacheInterface $cache,
|
||||
private PluginRepositoryInterface $pluginRepository,
|
||||
private ModuleRepositoryInterface $moduleRepository,
|
||||
) {}
|
||||
@@ -1830,8 +1830,10 @@ class LayoutExtensionService
|
||||
}
|
||||
|
||||
// extension_point 는 여러 레이아웃에서 사용될 수 있으므로 전역 캐시 버전 갱신
|
||||
// overlay 도 프론트엔드 브라우저 캐시 무효화를 위해 동일하게 갱신
|
||||
$this->cache->put('ext.cache_version', time());
|
||||
// overlay 도 프론트엔드 브라우저 캐시 무효화를 위해 동일하게 갱신.
|
||||
// 쓰기는 트레이트 단일 지점(고정 CoreCacheDriver + 메모이즈 스토어) 경유 —
|
||||
// 주입 CacheInterface 직접 put 은 재바인딩/스토어 상이 시 read 와 어긋난다.
|
||||
$this->incrementExtensionCacheVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,7 @@ use App\Exceptions\CircularReferenceException;
|
||||
use App\Exceptions\ConcurrentModificationException;
|
||||
use App\Exceptions\LayoutIncludeException;
|
||||
use App\Extension\HookManager;
|
||||
use App\Extension\Traits\ClearsTemplateCaches;
|
||||
use App\Helpers\PermissionHelper;
|
||||
use App\Models\TemplateLayout;
|
||||
use App\Models\User;
|
||||
@@ -21,6 +22,8 @@ use Illuminate\Support\Facades\Log;
|
||||
|
||||
class LayoutService
|
||||
{
|
||||
use ClearsTemplateCaches;
|
||||
|
||||
/**
|
||||
* LayoutRepository, LayoutVersionRepository, TemplateRepository, LayoutResolverService 및 LayoutExtensionService 주입
|
||||
*/
|
||||
@@ -1470,7 +1473,9 @@ class LayoutService
|
||||
// 프론트엔드 브라우저 캐시 무효화를 위해 ext.cache_version 증가
|
||||
// PublicLayoutController가 ?v={version} 기반 HTTP 캐시를 사용하므로
|
||||
// 버전 변경 시 브라우저가 새 URL로 인식하여 캐시를 우회합니다.
|
||||
$this->cache->put('ext.cache_version', time());
|
||||
// 쓰기는 트레이트 단일 지점(고정 CoreCacheDriver + 메모이즈 스토어) 경유 —
|
||||
// 주입 CacheInterface 직접 put 은 재바인딩/스토어 상이 시 read 와 어긋난다.
|
||||
$this->incrementExtensionCacheVersion();
|
||||
|
||||
// After 훅 - 레이아웃 업데이트 후
|
||||
HookManager::doAction('core.layout.after_update', $layout, $templateId, $name, $data);
|
||||
@@ -1579,8 +1584,8 @@ class LayoutService
|
||||
// 캐시 무효화
|
||||
$this->clearDependentLayoutsCache($templateId, $name);
|
||||
|
||||
// 프론트엔드 브라우저 캐시 무효화
|
||||
$this->cache->put('ext.cache_version', time());
|
||||
// 프론트엔드 브라우저 캐시 무효화 (트레이트 단일 지점 경유)
|
||||
$this->incrementExtensionCacheVersion();
|
||||
|
||||
// After 훅 - 버전 복원 후
|
||||
HookManager::doAction('core.layout.after_version_restore', $newVersion, $templateId, $name, $versionId);
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Contracts\Extension\CacheInterface;
|
||||
use App\Contracts\Repositories\TemplateCustomTranslationRepositoryInterface;
|
||||
use App\Exceptions\ConcurrentModificationException;
|
||||
use App\Extension\Traits\ClearsTemplateCaches;
|
||||
use App\Models\TemplateCustomTranslation;
|
||||
use App\Services\LanguagePack\CustomTranslationUsageScanner;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
@@ -22,10 +22,12 @@ use Illuminate\Database\QueryException;
|
||||
* - seq 충돌 시 재시도 (unique 제약 위반 → seq 증가)
|
||||
* - 신규 키 생성 시 모든 활성 로케일에 폴백 시드
|
||||
* - 낙관적 잠금 (`lock_version` — update 경로)
|
||||
* - 커스텀 키 CRUD 시 다국어 캐시 무효화
|
||||
* - 커스텀 키 CRUD 시 다국어 캐시 무효화
|
||||
*/
|
||||
class TemplateCustomTranslationService
|
||||
{
|
||||
use ClearsTemplateCaches;
|
||||
|
||||
/**
|
||||
* seq 충돌 재시도 최대 횟수.
|
||||
*/
|
||||
@@ -33,11 +35,9 @@ class TemplateCustomTranslationService
|
||||
|
||||
/**
|
||||
* @param TemplateCustomTranslationRepositoryInterface $repository 커스텀 다국어 키 리포지토리
|
||||
* @param CacheInterface $cache 캐시 드라이버
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly TemplateCustomTranslationRepositoryInterface $repository,
|
||||
private readonly CacheInterface $cache,
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -287,11 +287,12 @@ class TemplateCustomTranslationService
|
||||
*
|
||||
* `serveLanguage` 캐시 키가 `template.language.{id}.{locale}.v{cacheVersion}`
|
||||
* 형태로 `ext.cache_version` 을 포함하므로, 이 값을 갱신하면 다음
|
||||
* `loadTranslations` 가 재fetch 합니다.
|
||||
* `loadTranslations` 가 재fetch 합니다. 쓰기는 트레이트 단일 지점
|
||||
* (고정 CoreCacheDriver + 메모이즈 스토어) 경유.
|
||||
*/
|
||||
private function invalidateLanguageCache(): void
|
||||
{
|
||||
$this->cache->put('ext.cache_version', time());
|
||||
$this->incrementExtensionCacheVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user