aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/service/MessagesService.java21
-rw-r--r--src/main/resources/application.properties2
2 files changed, 15 insertions, 8 deletions
diff --git a/src/main/java/com/juick/service/MessagesService.java b/src/main/java/com/juick/service/MessagesService.java
index 626cc495..1afeb216 100644
--- a/src/main/java/com/juick/service/MessagesService.java
+++ b/src/main/java/com/juick/service/MessagesService.java
@@ -33,10 +33,10 @@ import java.util.*;
* Created by aalexeev on 11/13/16.
*/
public interface MessagesService {
- @CacheEvict(value = { "discussions", "messages", "replies" }, allEntries = true)
+ @CacheEvict(value = { "discover", "discussions", "messages", "replies" }, allEntries = true)
int createMessage(int uid, String txt, String attachment, Set<Tag> tags);
- @CacheEvict(value = { "discussions", "messages", "replies" }, allEntries = true)
+ @CacheEvict(value = { "discover", "discussions", "messages", "replies" }, allEntries = true)
int createReply(int mid, int rid, User user, String txt, String attachment);
enum RecommendStatus {
Error,
@@ -44,14 +44,18 @@ public interface MessagesService {
Deleted
}
+ @CacheEvict(value = { "discover", "discussions", "messages", "replies" }, allEntries = true)
RecommendStatus recommendMessage(int mid, int vuid, String userUri);
+ @CacheEvict(value = { "discover", "discussions", "messages", "replies" }, allEntries = true)
RecommendStatus recommendMessage(int mid, int vuid);
List<Reaction> listReactions();
+ @CacheEvict(value = { "discover", "discussions", "messages", "replies" }, allEntries = true)
RecommendStatus likeMessage(int mid, int vuid, Integer reaction);
+ @CacheEvict(value = { "discover", "discussions", "messages", "replies" }, allEntries = true)
RecommendStatus likeMessage(int mid, int vuid, Integer reaction, String userUri);
@@ -59,6 +63,7 @@ public interface MessagesService {
boolean isReadOnly(int mid);
+ @CacheEvict(value = { "discover", "discussions", "messages", "replies" }, allEntries = true)
void setReadOnly(int mid, boolean readonly);
boolean isSubscribed(int uid, int mid);
@@ -75,6 +80,7 @@ public interface MessagesService {
List<Pair<Integer, User>> getMessagesRecommendations(Collection<Integer> mids);
+ @Cacheable(value = "discover", key="#visitorUid + #before")
List<Integer> getAll(int visitorUid, int before);
List<Integer> getTag(int tid, int visitorUid, int before, int cnt);
@@ -119,6 +125,7 @@ public interface MessagesService {
@Cacheable(value = "messages", key="#visitor.uid + #mids.hashCode()")
List<Message> getMessages(User visitor, List<Integer> mids);
+ @CacheEvict(value = { "discover", "discussions", "messages", "replies" }, allEntries = true)
Map<Integer,Set<Reaction>> updateReactionsFor(final List<Integer> mid);
@Cacheable(value = "replies", key="#user.uid + #mid")
@@ -126,10 +133,10 @@ public interface MessagesService {
boolean setMessagePrivacy(int mid);
- @CacheEvict(value = { "discussions", "messages", "replies" }, allEntries = true)
+ @CacheEvict(value = { "discover", "discussions", "messages", "replies" }, allEntries = true)
boolean deleteMessage(int uid, int mid);
- @CacheEvict(value = { "discussions", "messages", "replies" }, allEntries = true)
+ @CacheEvict(value = { "discover", "discussions", "messages", "replies" }, allEntries = true)
boolean deleteReply(int uid, int mid, int rid);
List<Integer> getLastMessages(int hours);
@@ -144,15 +151,15 @@ public interface MessagesService {
List<Integer> getUnread(User user);
- @CacheEvict(value = { "discussions", "messages", "replies" }, allEntries = true)
+ @CacheEvict(value = { "discover", "discussions", "messages", "replies" }, allEntries = true)
boolean updateMessage(Integer mid, Integer rid, String body);
- @CacheEvict(value = { "discussions", "messages", "replies" }, allEntries = true)
+ @CacheEvict(value = { "discover", "discussions", "messages", "replies" }, allEntries = true)
boolean updateReplyUri(Message reply, URI replyUri);
boolean replyExists(URI replyUri);
- @CacheEvict(value = { "discussions", "messages", "replies" }, allEntries = true)
+ @CacheEvict(value = { "discover", "discussions", "messages", "replies" }, allEntries = true)
boolean deleteReply(URI userUri, URI replyUri);
String getMessageProperty(Integer mid, Integer rid, String key);
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index efda260f..b23842ee 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -7,5 +7,5 @@ spring.h2.console.enabled=true
spring.datasource.generate-unique-name=false
spring.sql.init.platform=h2
spring.cache.type=none
-spring.cache.cache-names=help, users_by_name, discussions, messages, replies, popular_tags
+spring.cache.cache-names=help, users_by_name, discover, discussions, messages, replies, popular_tags
spring.profiles.active=@activatedProperties@