mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-05-11 21:27:31 +08:00
Merge pull request #988 from nagisa77/codex/update-post_cache_name-to-handle-pagination
Fix post cache keys to include pagination parameters
This commit is contained in:
@@ -52,7 +52,7 @@ public class CommentService {
|
|||||||
|
|
||||||
@CacheEvict(
|
@CacheEvict(
|
||||||
value = CachingConfig.POST_CACHE_NAME,
|
value = CachingConfig.POST_CACHE_NAME,
|
||||||
key = "'latest_reply'"
|
allEntries = true
|
||||||
)
|
)
|
||||||
@Transactional
|
@Transactional
|
||||||
public Comment addComment(String username, Long postId, String content) {
|
public Comment addComment(String username, Long postId, String content) {
|
||||||
@@ -104,7 +104,7 @@ public class CommentService {
|
|||||||
|
|
||||||
@CacheEvict(
|
@CacheEvict(
|
||||||
value = CachingConfig.POST_CACHE_NAME,
|
value = CachingConfig.POST_CACHE_NAME,
|
||||||
key = "'latest_reply'"
|
allEntries = true
|
||||||
)
|
)
|
||||||
@Transactional
|
@Transactional
|
||||||
public Comment addReply(String username, Long parentId, String content) {
|
public Comment addReply(String username, Long parentId, String content) {
|
||||||
@@ -241,7 +241,7 @@ public class CommentService {
|
|||||||
|
|
||||||
@CacheEvict(
|
@CacheEvict(
|
||||||
value = CachingConfig.POST_CACHE_NAME,
|
value = CachingConfig.POST_CACHE_NAME,
|
||||||
key = "'latest_reply'"
|
allEntries = true
|
||||||
)
|
)
|
||||||
@Transactional
|
@Transactional
|
||||||
public void deleteComment(String username, Long id) {
|
public void deleteComment(String username, Long id) {
|
||||||
@@ -260,7 +260,7 @@ public class CommentService {
|
|||||||
|
|
||||||
@CacheEvict(
|
@CacheEvict(
|
||||||
value = CachingConfig.POST_CACHE_NAME,
|
value = CachingConfig.POST_CACHE_NAME,
|
||||||
key = "'latest_reply'"
|
allEntries = true
|
||||||
)
|
)
|
||||||
@Transactional
|
@Transactional
|
||||||
public void deleteCommentCascade(Comment comment) {
|
public void deleteCommentCascade(Comment comment) {
|
||||||
|
|||||||
@@ -509,7 +509,7 @@ public class PostService {
|
|||||||
|
|
||||||
@Cacheable(
|
@Cacheable(
|
||||||
value = CachingConfig.POST_CACHE_NAME,
|
value = CachingConfig.POST_CACHE_NAME,
|
||||||
key = "'latest_reply'"
|
key = "new org.springframework.cache.interceptor.SimpleKey('latest_reply', #categoryIds, #tagIds, #page, #pageSize)"
|
||||||
)
|
)
|
||||||
public List<Post> listPostsByLatestReply(java.util.List<Long> categoryIds,
|
public List<Post> listPostsByLatestReply(java.util.List<Long> categoryIds,
|
||||||
java.util.List<Long> tagIds,
|
java.util.List<Long> tagIds,
|
||||||
@@ -648,7 +648,7 @@ public class PostService {
|
|||||||
*/
|
*/
|
||||||
@Cacheable(
|
@Cacheable(
|
||||||
value = CachingConfig.POST_CACHE_NAME,
|
value = CachingConfig.POST_CACHE_NAME,
|
||||||
key = "'default'"
|
key = "new org.springframework.cache.interceptor.SimpleKey('default', #ids, #tids, #page, #pageSize)"
|
||||||
)
|
)
|
||||||
public List<Post> defaultListPosts(List<Long> ids, List<Long> tids, Integer page, Integer pageSize){
|
public List<Post> defaultListPosts(List<Long> ids, List<Long> tids, Integer page, Integer pageSize){
|
||||||
boolean hasCategories = !CollectionUtils.isEmpty(ids);
|
boolean hasCategories = !CollectionUtils.isEmpty(ids);
|
||||||
@@ -673,7 +673,7 @@ public class PostService {
|
|||||||
|
|
||||||
@CacheEvict(
|
@CacheEvict(
|
||||||
value = CachingConfig.POST_CACHE_NAME,
|
value = CachingConfig.POST_CACHE_NAME,
|
||||||
key = "'default'"
|
allEntries = true
|
||||||
)
|
)
|
||||||
public Post approvePost(Long id) {
|
public Post approvePost(Long id) {
|
||||||
Post post = postRepository.findById(id)
|
Post post = postRepository.findById(id)
|
||||||
@@ -713,7 +713,7 @@ public class PostService {
|
|||||||
|
|
||||||
@CacheEvict(
|
@CacheEvict(
|
||||||
value = CachingConfig.POST_CACHE_NAME,
|
value = CachingConfig.POST_CACHE_NAME,
|
||||||
key = "'default'"
|
allEntries = true
|
||||||
)
|
)
|
||||||
public Post pinPost(Long id, String username) {
|
public Post pinPost(Long id, String username) {
|
||||||
Post post = postRepository.findById(id)
|
Post post = postRepository.findById(id)
|
||||||
@@ -729,7 +729,7 @@ public class PostService {
|
|||||||
|
|
||||||
@CacheEvict(
|
@CacheEvict(
|
||||||
value = CachingConfig.POST_CACHE_NAME,
|
value = CachingConfig.POST_CACHE_NAME,
|
||||||
key = "'default'"
|
allEntries = true
|
||||||
)
|
)
|
||||||
public Post unpinPost(Long id, String username) {
|
public Post unpinPost(Long id, String username) {
|
||||||
Post post = postRepository.findById(id)
|
Post post = postRepository.findById(id)
|
||||||
@@ -745,7 +745,7 @@ public class PostService {
|
|||||||
|
|
||||||
@CacheEvict(
|
@CacheEvict(
|
||||||
value = CachingConfig.POST_CACHE_NAME,
|
value = CachingConfig.POST_CACHE_NAME,
|
||||||
key = "'default'"
|
allEntries = true
|
||||||
)
|
)
|
||||||
public Post closePost(Long id, String username) {
|
public Post closePost(Long id, String username) {
|
||||||
Post post = postRepository.findById(id)
|
Post post = postRepository.findById(id)
|
||||||
@@ -764,7 +764,7 @@ public class PostService {
|
|||||||
|
|
||||||
@CacheEvict(
|
@CacheEvict(
|
||||||
value = CachingConfig.POST_CACHE_NAME,
|
value = CachingConfig.POST_CACHE_NAME,
|
||||||
key = "'default'"
|
allEntries = true
|
||||||
)
|
)
|
||||||
public Post reopenPost(Long id, String username) {
|
public Post reopenPost(Long id, String username) {
|
||||||
Post post = postRepository.findById(id)
|
Post post = postRepository.findById(id)
|
||||||
@@ -783,7 +783,7 @@ public class PostService {
|
|||||||
|
|
||||||
@CacheEvict(
|
@CacheEvict(
|
||||||
value = CachingConfig.POST_CACHE_NAME,
|
value = CachingConfig.POST_CACHE_NAME,
|
||||||
key = "'default'"
|
allEntries = true
|
||||||
)
|
)
|
||||||
@Transactional
|
@Transactional
|
||||||
public Post updatePost(Long id,
|
public Post updatePost(Long id,
|
||||||
@@ -840,7 +840,7 @@ public class PostService {
|
|||||||
|
|
||||||
@CacheEvict(
|
@CacheEvict(
|
||||||
value = CachingConfig.POST_CACHE_NAME,
|
value = CachingConfig.POST_CACHE_NAME,
|
||||||
key = "'default'"
|
allEntries = true
|
||||||
)
|
)
|
||||||
@Transactional
|
@Transactional
|
||||||
public void deletePost(Long id, String username) {
|
public void deletePost(Long id, String username) {
|
||||||
|
|||||||
Reference in New Issue
Block a user