use of org.springframework.cache.annotation.CacheEvict in project ORCID-Source by ORCID.
the class IdentifierTypeManagerImpl method createIdentifierType.
@Override
@CacheEvict(value = { "identifier-types", "identifier-types-map" }, allEntries = true)
public IdentifierType createIdentifierType(IdentifierType id) {
IdentifierTypeEntity entity = adapter.fromPojo(id);
SourceEntity source = sourceManager.retrieveSourceEntity();
entity.setSourceClient(source.getSourceClient());
Date now = new Date();
entity.setDateCreated(now);
entity.setLastModified(now);
entity = idTypeDao.addIdentifierType(entity);
return adapter.fromEntity(entity);
}
use of org.springframework.cache.annotation.CacheEvict in project sagacity-sqltoy by chenrenfei.
the class OrganInfoServiceImpl method add.
/*
* (non-Javadoc)
*
* @see sqltoy.showcase.system.service.OrganInfoService#add(sqltoy.showcase.
* system.vo.OrganInfoVO)
*/
@Override
@CacheEvict(value = "organIdNameCache", allEntries = true)
public void add(OrganInfoVO organInfoVO) throws BaseException {
try {
sqlToyLazyDao.save(organInfoVO);
logger.info("新增机构信息成功!");
} catch (Exception e) {
e.printStackTrace();
logger.error("新增机构信息失败!");
throw new BaseException("新增机构信息失败!", e);
}
}
use of org.springframework.cache.annotation.CacheEvict in project halo by ruibaby.
the class PostServiceImpl method updateAllSummary.
/**
* 批量更新文章摘要
*
* @param postSummary postSummary
*/
@CacheEvict(value = POST_CACHE_NAME, key = POST_KEY)
@Override
public void updateAllSummary(Integer postSummary) {
List<Post> posts = this.findAllPosts();
for (Post post : posts) {
if (!(HaloUtil.htmlToText(post.getPostContent()).length() < postSummary)) {
post.setPostSummary(HaloUtil.getSummary(post.getPostContent(), postSummary));
postRepository.save(post);
}
}
}
use of org.springframework.cache.annotation.CacheEvict in project halo by ruibaby.
the class OptionsServiceImpl method saveOption.
/**
* 保存单个设置选项
*
* @param key key
* @param value value
*/
@CacheEvict(value = OPTIONS_CACHE_NAME, key = OPTIONS_KEY)
@Override
public void saveOption(String key, String value) {
Options options = null;
if ("".equals(value)) {
options = new Options();
options.setOptionName(key);
this.removeOption(options);
} else {
if (HaloUtil.isNotNull(key)) {
// 如果查询到有该设置选项则做更新操作,反之保存新的设置选项
if (null == optionsRepository.findOptionsByOptionName(key)) {
options = new Options();
options.setOptionName(key);
options.setOptionValue(value);
optionsRepository.save(options);
} else {
options = optionsRepository.findOptionsByOptionName(key);
options.setOptionValue(value);
optionsRepository.save(options);
}
}
}
}
use of org.springframework.cache.annotation.CacheEvict in project spring_boot by hryou0922.
the class BookService method updateBook.
/**
* 对符合key条件的记录从缓存中book1移除
*/
@CacheEvict(cacheNames = "book1", key = "#id")
public void updateBook(String id, String name) {
logger.info("updateBook");
Book book = repositoryBook.get(id);
if (book != null) {
book.setName(name);
book.setUpdate(new Date());
}
}
Aggregations