3737import org .jetbrains .annotations .NotNull ;
3838
3939import org .springframework .boot .web .client .RestTemplateBuilder ;
40+ import org .springframework .cache .annotation .Cacheable ;
4041import org .springframework .core .ParameterizedTypeReference ;
4142import org .springframework .http .HttpStatusCode ;
4243import org .springframework .http .MediaType ;
@@ -94,6 +95,7 @@ private static int compare(ProjectDocumentation o1, ProjectDocumentation o2) {
9495 return -version1 .compareTo (version2 );
9596 }
9697
98+ @ Cacheable (value = "documentation" , key = "#projectSlug" )
9799 public List <ProjectDocumentation > getProjectDocumentations (String projectSlug ) {
98100 ResponseEntity <Map <String , Object >> response = getFile (projectSlug , "documentation.json" );
99101 String content = getFileContents (response );
@@ -250,6 +252,7 @@ private String getFileSha(ResponseEntity<Map<String, Object>> exchange) {
250252 return (String ) exchange .getBody ().get ("sha" );
251253 }
252254
255+ @ Cacheable ("projects" )
253256 public List <Project > getProjects () {
254257 List <Project > projects = new ArrayList <>();
255258 try {
@@ -274,6 +277,7 @@ public List<Project> getProjects() {
274277 return projects ;
275278 }
276279
280+ @ Cacheable (value = "project" , key = "#projectSlug" )
277281 public Project getProject (String projectSlug ) {
278282 ResponseEntity <Map <String , Object >> response = getFile (projectSlug , "index.md" );
279283 String contents = getFileContents (response );
@@ -283,6 +287,7 @@ public Project getProject(String projectSlug) {
283287 return this .objectMapper .convertValue (frontMatter , Project .class );
284288 }
285289
290+ @ Cacheable (value = "support" , key = "#projectSlug" )
286291 public List <ProjectSupport > getProjectSupports (String projectSlug ) {
287292 ResponseEntity <Map <String , Object >> response = getFile (projectSlug , "support.json" );
288293 if (response == null ) {
@@ -299,6 +304,7 @@ public List<ProjectSupport> getProjectSupports(String projectSlug) {
299304 }
300305 }
301306
307+ @ Cacheable (value = "support_policy" , key = "#projectSlug" )
302308 public String getProjectSupportPolicy (String projectSlug ) {
303309 ResponseEntity <Map <String , Object >> indexResponse = getFile (projectSlug , "index.md" );
304310 String indexContents = getFileContents (indexResponse );
0 commit comments