Search in sources :

Example 31 with CacheEvict

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);
}
Also used : SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) IdentifierTypeEntity(org.orcid.persistence.jpa.entities.IdentifierTypeEntity) Date(java.util.Date) CacheEvict(org.springframework.cache.annotation.CacheEvict)

Example 32 with CacheEvict

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);
    }
}
Also used : BaseException(org.sagacity.sqltoy.exception.BaseException) BaseException(org.sagacity.sqltoy.exception.BaseException) CacheEvict(org.springframework.cache.annotation.CacheEvict)

Example 33 with CacheEvict

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);
        }
    }
}
Also used : Post(cc.ryanc.halo.model.domain.Post) CacheEvict(org.springframework.cache.annotation.CacheEvict)

Example 34 with CacheEvict

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);
            }
        }
    }
}
Also used : Options(cc.ryanc.halo.model.domain.Options) CacheEvict(org.springframework.cache.annotation.CacheEvict)

Example 35 with CacheEvict

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());
    }
}
Also used : Book(com.hry.spring.redis.cache.support.Book) Date(java.util.Date) CacheEvict(org.springframework.cache.annotation.CacheEvict)

Aggregations

CacheEvict (org.springframework.cache.annotation.CacheEvict)53 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)14 Transactional (org.springframework.transaction.annotation.Transactional)13 Date (java.util.Date)8 ArrayList (java.util.ArrayList)6 CacheInfoEvict (org.entando.entando.aps.system.services.cache.CacheInfoEvict)5 QUser (com.github.liuweijw.business.admin.domain.QUser)3 MetacatRequestContext (com.netflix.metacat.common.MetacatRequestContext)3 ConnectorRequestContext (com.netflix.metacat.common.server.connectors.ConnectorRequestContext)3 ConnectorTableService (com.netflix.metacat.common.server.connectors.ConnectorTableService)3 QMenu (com.github.liuweijw.business.admin.domain.QMenu)2 QRole (com.github.liuweijw.business.admin.domain.QRole)2 QUserRole (com.github.liuweijw.business.admin.domain.QUserRole)2 Role (com.github.liuweijw.business.admin.domain.Role)2 User (com.github.liuweijw.business.admin.domain.User)2 UserRole (com.github.liuweijw.business.admin.domain.UserRole)2 AuthUser (com.github.liuweijw.system.api.model.AuthUser)2 RoleMenuDO (io.github.tesla.ops.system.domain.RoleMenuDO)2 Connection (java.sql.Connection)2 HashMap (java.util.HashMap)2