Sfoglia il codice sorgente

修改清空缓存参数

ouyang 3 anni fa
parent
commit
bd560b86c6
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 2 2
      src/main/java/com/izouma/nineth/repo/UserRepo.java

+ 2 - 2
src/main/java/com/izouma/nineth/repo/UserRepo.java

@@ -48,19 +48,19 @@ public interface UserRepo extends JpaRepository<User, Long>, JpaSpecificationExe
             "where f.followUserId = ?1 and u.del = false ")
     List<User> userFollowers(Long userId);
 
-    @CacheEvict(value = "user" ,key = "#userId")
     @Transactional
     @Modifying
     @Query(value = "update user set follows = (select count(*) from follow " +
             "where follow.user_id = ?1) where user.id = ?1", nativeQuery = true)
+    @CacheEvict(value = {"myUserInfo","user"} ,allEntries = true)
     void updateFollows(Long userId);
 
 
-    @CacheEvict(value = "user" ,key = "#userId")
     @Transactional
     @Modifying
     @Query(value = "update user set followers = (select count(*) from follow " +
             "where follow.follow_user_id = ?1) where user.id = ?1", nativeQuery = true)
+    @CacheEvict(value = {"myUserInfo","user"} ,allEntries = true)
     void updateFollowers(Long userId);
 
     @Transactional