From 36ebeb217326c6bc23dedfde1e028ae2286afe02 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 24 Dec 2022 03:28:02 +0300 Subject: Cacheable ActivityPub profiles --- src/main/java/com/juick/www/api/activity/Profile.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/main/java/com/juick/www/api/activity/Profile.java') diff --git a/src/main/java/com/juick/www/api/activity/Profile.java b/src/main/java/com/juick/www/api/activity/Profile.java index 506f5ace..404e0734 100644 --- a/src/main/java/com/juick/www/api/activity/Profile.java +++ b/src/main/java/com/juick/www/api/activity/Profile.java @@ -55,9 +55,11 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; +import org.springframework.cache.annotation.CacheEvict; import org.springframework.context.ApplicationEventPublisher; import org.springframework.core.convert.ConversionService; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -268,6 +270,7 @@ public class Profile { throw new HttpNotFoundException(); } + @CacheEvict(cacheNames = "profiles", key = "{ #visitor.uri }") @PostMapping(value = "/api/inbox", consumes = { Context.LD_JSON_MEDIA_TYPE, Context.ACTIVITYSTREAMS_PROFILE_MEDIA_TYPE }) public ResponseEntity processInbox(@Visitor User visitor, InputStream inboxData) throws Exception { -- cgit v1.2.3