Skip to content

Commit

Permalink
修改缓存注解写法,修复缓存不成功的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
lcg0124 committed Oct 19, 2018
1 parent acea5cf commit 4d22a5d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand All @@ -30,7 +31,6 @@

import javax.imageio.ImageIO;

//@CacheConfig(cacheNames = "user")
@Transactional
@Service
public class UserServiceImpl implements UserService {
Expand All @@ -47,7 +47,7 @@ public class UserServiceImpl implements UserService {
private static final Logger logger = LoggerFactory.getLogger(UserService.class);

@Override
// @Cacheable(key = "#id")
// @Cacheable(value = "user",key = "#id")
public UserDO get(Long id) {
List<Long> roleIds = userRoleMapper.listRoleId(id);
UserDO user = userMapper.get(id);
Expand Down Expand Up @@ -105,6 +105,7 @@ public int update(UserDO user) {
return r;
}

// @CacheEvict(value = "user")
@Override
public int remove(Long userId) {
userRoleMapper.removeByUserId(userId);
Expand Down

0 comments on commit 4d22a5d

Please sign in to comment.