Summary
The frontend now supports tag-based cache invalidation via cacheTag() (added in PR #85), but the backend FrontendRevalidationService only supports path-based revalidation ({"path": "..."}). Add a revalidateTag(tag: String) method to complete the end-to-end cache invalidation flow.
Current State
- Frontend:
/api/revalidate endpoint accepts {"tag": "gallery"} and calls revalidateTag(tag, { expire: 0 })
- Frontend pages: Use
cacheTag("directory"), cacheTag("gallery"), cacheTag(\photo:${id}`), cacheTag(`entry:${category}:${slug}`)`, etc.
- Backend:
FrontendRevalidationService.revalidatePath() only sends {"path": "/..."} — no tag support
Proposed Changes
- Add
revalidateTag(tag: String) method to FrontendRevalidationService
- Send
{"tag": "gallery"} body format to /api/revalidate
- Call
revalidateTag("gallery") from gallery admin operations (promote hero, approve/reject media)
- Call
revalidateTag("directory") from directory admin operations
Files
apps/api/src/main/kotlin/com/nosilha/core/shared/service/FrontendRevalidationService.kt
- Gallery and directory admin service classes that trigger revalidation
Context
This was identified during code review of PR #85 (Phase 1 performance optimization). The tag infrastructure was scaffolded on the frontend; this issue completes the backend integration (Phase 2).
Summary
The frontend now supports tag-based cache invalidation via
cacheTag()(added in PR #85), but the backendFrontendRevalidationServiceonly supports path-based revalidation ({"path": "..."}). Add arevalidateTag(tag: String)method to complete the end-to-end cache invalidation flow.Current State
/api/revalidateendpoint accepts{"tag": "gallery"}and callsrevalidateTag(tag, { expire: 0 })cacheTag("directory"),cacheTag("gallery"),cacheTag(\photo:${id}`),cacheTag(`entry:${category}:${slug}`)`, etc.FrontendRevalidationService.revalidatePath()only sends{"path": "/..."}— no tag supportProposed Changes
revalidateTag(tag: String)method toFrontendRevalidationService{"tag": "gallery"}body format to/api/revalidaterevalidateTag("gallery")from gallery admin operations (promote hero, approve/reject media)revalidateTag("directory")from directory admin operationsFiles
apps/api/src/main/kotlin/com/nosilha/core/shared/service/FrontendRevalidationService.ktContext
This was identified during code review of PR #85 (Phase 1 performance optimization). The tag infrastructure was scaffolded on the frontend; this issue completes the backend integration (Phase 2).