diff --git a/.agents/journal/bolt.md b/.agents/journal/bolt.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/server/modules/resume/resume-application/src/main/kotlin/com/cvix/resume/application/template/TemplateCatalog.kt b/server/modules/resume/resume-application/src/main/kotlin/com/cvix/resume/application/template/TemplateCatalog.kt index 8552197b9..711d9920d 100644 --- a/server/modules/resume/resume-application/src/main/kotlin/com/cvix/resume/application/template/TemplateCatalog.kt +++ b/server/modules/resume/resume-application/src/main/kotlin/com/cvix/resume/application/template/TemplateCatalog.kt @@ -5,6 +5,7 @@ import com.cvix.resume.domain.TemplateMetadata import com.cvix.resume.domain.TemplateSourceStrategy import com.cvix.subscription.domain.SubscriptionTier import org.slf4j.LoggerFactory +import org.springframework.cache.annotation.Cacheable /** * Catalog service for managing and retrieving template metadata. @@ -44,6 +45,9 @@ class TemplateCatalog(private val templateSourceStrategy: TemplateSourceStrategy * @param limit Maximum number of templates to return (null = no limit) * @return List of template metadata from all active sources, filtered by subscription tier */ + // Performance: Cache results to avoid repeated scanning of template repositories. + // Keyed by tier and limit as these are the primary filter criteria. + @Cacheable(value = ["templates"], key = "#subscriptionTier.toString() + '-' + (#limit ?: -1)") suspend fun listTemplates( subscriptionTier: SubscriptionTier, limit: Int? diff --git a/server/modules/resume/resume-application/src/main/kotlin/com/cvix/resume/application/template/TemplateFinder.kt b/server/modules/resume/resume-application/src/main/kotlin/com/cvix/resume/application/template/TemplateFinder.kt index d929f59db..87565524c 100644 --- a/server/modules/resume/resume-application/src/main/kotlin/com/cvix/resume/application/template/TemplateFinder.kt +++ b/server/modules/resume/resume-application/src/main/kotlin/com/cvix/resume/application/template/TemplateFinder.kt @@ -8,6 +8,7 @@ import com.cvix.resume.domain.exception.TemplateNotFoundException import com.cvix.subscription.domain.SubscriptionTier import java.util.UUID import org.slf4j.LoggerFactory +import org.springframework.cache.annotation.Cacheable /** * Service for finding and validating template access. @@ -37,6 +38,9 @@ class TemplateFinder( * @throws TemplateNotFoundException if template not found in any active repository * @throws TemplateAccessDeniedException if user lacks required subscription tier */ + // Performance: Cache template details and access validation results. + // Keyed by template and tier; userId is excluded as access is strictly tier-based. + @Cacheable(value = ["template-details"], key = "#templateId + '-' + #userTier.toString()") suspend fun findByIdAndValidateAccess( templateId: String, userId: UUID,