Example usage for org.springframework.cache.support SimpleCacheManager setCaches

List of usage examples for org.springframework.cache.support SimpleCacheManager setCaches

Introduction

In this page you can find the example usage for org.springframework.cache.support SimpleCacheManager setCaches.

Prototype

public void setCaches(Collection<? extends Cache> caches) 

Source Link

Document

Specify the collection of Cache instances to use for this CacheManager.

Usage

From source file:com.stratio.decision.shell.configuration.CacheConfiguration.java

@Override
@Bean/*from www.  ja  v  a2s  .c o m*/
public CacheManager cacheManager() {
    SimpleCacheManager cacheManager = new SimpleCacheManager();
    cacheManager.setCaches(Arrays.asList(new ConcurrentMapCache("streams")));
    return cacheManager;
}

From source file:cn.ilongfei.springbootbasic.CachingConfiguration.java

@Bean
public CacheManager cacheManager() {

    Cache cache = new ConcurrentMapCache("byUsername");

    SimpleCacheManager manager = new SimpleCacheManager();
    manager.setCaches(Arrays.asList(cache));

    return manager;
}

From source file:ru.org.linux.user.UserDaoIntegrationTestConfiguration.java

@Bean
public CacheManager cacheManager() {
    SimpleCacheManager cacheManager = new SimpleCacheManager();

    cacheManager.setCaches(ImmutableList.of(new ConcurrentMapCache(USERS_CACHE)));

    return cacheManager;
}

From source file:nu.yona.server.goals.service.ActivityCategoryServiceTestConfiguration.java

@Bean
public SimpleCacheManager cacheManager() {
    SimpleCacheManager cacheManager = new SimpleCacheManager();
    cacheManager.setCaches(Arrays.asList(mockActivityCategorySetCache));
    return cacheManager;
}

From source file:com.axel.config.ServiceConfig.java

@Bean
public CacheManager cacheManager() {
    SimpleCacheManager cacheManager = new SimpleCacheManager();
    List<Cache> caches = new ArrayList<Cache>();
    // to customize
    caches.add(defaultCache());/*from w  w  w  . j a v  a 2 s .c  o  m*/
    cacheManager.setCaches(caches);
    return cacheManager;
}

From source file:se.uu.it.cs.recsys.semantic.config.ComputingDomainReasonerSpringConfig.java

@Bean
public CacheManager cacheManager() {
    SimpleCacheManager cacheManager = new SimpleCacheManager();

    GuavaCache fpTreeCache = new GuavaCache("ComputingDomainCache",
            CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.DAYS).maximumSize(100).build());

    cacheManager.setCaches(Stream.of(fpTreeCache).collect(Collectors.toList()));

    return cacheManager;
}

From source file:com.zuoxiaolong.blog.cache.config.GuavaCacheConfig.java

@Bean
@Override//w  w  w . j  a  v a  2 s  . c  om
public CacheManager cacheManager() {
    SimpleCacheManager cacheManager = new SimpleCacheManager();

    GuavaCache guavaCache = new GuavaCache(BLOG_CACHE,
            CacheBuilder.newBuilder().expireAfterWrite(5, TimeUnit.MINUTES) //5
                    .build());

    cacheManager.setCaches(Arrays.asList(guavaCache));
    return cacheManager;
}

From source file:se.uu.it.cs.recsys.ruleminer.config.CourseRecommenderRuleMinerSpringConfig.java

@Bean
public CacheManager cacheManager() {
    SimpleCacheManager cacheManager = new SimpleCacheManager();

    GuavaCache fpTreeCache = new GuavaCache("FPTrees",
            CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.DAYS).maximumSize(100).build());

    GuavaCache fpPatternCache = new GuavaCache("FPPatterns",
            CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.DAYS).maximumSize(100).build());

    cacheManager.setCaches(Stream.of(fpTreeCache, fpPatternCache).collect(Collectors.toList()));

    return cacheManager;
}

From source file:com.epam.ta.reportportal.TestConfig.java

@Bean
@Primary//from  w w  w .j  a  v a2 s  . c  om
public CacheManager getGlobalCacheManager() {
    SimpleCacheManager cacheManager = new SimpleCacheManager();

    GuavaCache tickets = new GuavaCache(EXTERNAL_SYSTEM_TICKET_CACHE,
            CacheBuilder.newBuilder().maximumSize(ticketCacheSize).softValues()
                    .expireAfterAccess(ticketCacheExpiration, TimeUnit.MINUTES).build());
    GuavaCache projects = new GuavaCache(JIRA_PROJECT_CACHE,
            CacheBuilder.newBuilder().maximumSize(projectCacheSize).softValues()
                    .expireAfterAccess(projectCacheExpiration, TimeUnit.DAYS).build());
    GuavaCache users = new GuavaCache(USERS_CACHE, CacheBuilder.newBuilder().maximumSize(userCacheSize)
            .expireAfterWrite(userCacheExpiration, TimeUnit.MINUTES).build());
    GuavaCache projectInfo = new GuavaCache(PROJECT_INFO_CACHE,
            CacheBuilder.newBuilder().maximumSize(projectCacheSize).softValues()
                    .expireAfterWrite(projectInfoCacheExpiration, TimeUnit.MINUTES).build());
    GuavaCache assignedUsers = new GuavaCache(ASSIGNED_USERS_CACHE,
            CacheBuilder.newBuilder().maximumSize(userCacheSize).weakKeys()
                    .expireAfterWrite(userCacheExpiration, TimeUnit.MINUTES).build());

    //@formatter:off
    cacheManager.setCaches(ImmutableList.<GuavaCache>builder().add(tickets).add(projects).add(users)
            .add(projectInfo).add(assignedUsers).build());
    //@formatter:on
    return cacheManager;
}