Explorar el Código

修改清空缓存参数

ouyang hace 3 años
padre
commit
bd560b86c6
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  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