Search in sources :

Example 1 with ConcurrentMapCacheManager

use of org.springframework.cache.concurrent.ConcurrentMapCacheManager in project spring-boot by spring-projects.

the class SimpleCacheConfiguration method cacheManager.

@Bean
public ConcurrentMapCacheManager cacheManager() {
    ConcurrentMapCacheManager cacheManager = new ConcurrentMapCacheManager();
    List<String> cacheNames = this.cacheProperties.getCacheNames();
    if (!cacheNames.isEmpty()) {
        cacheManager.setCacheNames(cacheNames);
    }
    return this.customizerInvoker.customize(cacheManager);
}
Also used : ConcurrentMapCacheManager(org.springframework.cache.concurrent.ConcurrentMapCacheManager) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with ConcurrentMapCacheManager

use of org.springframework.cache.concurrent.ConcurrentMapCacheManager in project spring-boot by spring-projects.

the class CacheAutoConfigurationTests method simpleCacheExplicit.

@Test
public void simpleCacheExplicit() {
    load(DefaultCacheConfiguration.class, "spring.cache.type=simple");
    ConcurrentMapCacheManager cacheManager = validateCacheManager(ConcurrentMapCacheManager.class);
    assertThat(cacheManager.getCacheNames()).isEmpty();
}
Also used : ConcurrentMapCacheManager(org.springframework.cache.concurrent.ConcurrentMapCacheManager) Test(org.junit.Test)

Example 3 with ConcurrentMapCacheManager

use of org.springframework.cache.concurrent.ConcurrentMapCacheManager in project spring-boot by spring-projects.

the class CacheAutoConfigurationTests method cacheManagerFromSupportBackOff.

@Test
public void cacheManagerFromSupportBackOff() {
    load(CustomCacheManagerFromSupportConfiguration.class);
    ConcurrentMapCacheManager cacheManager = validateCacheManager(ConcurrentMapCacheManager.class);
    assertThat(cacheManager.getCacheNames()).containsOnly("custom1");
}
Also used : ConcurrentMapCacheManager(org.springframework.cache.concurrent.ConcurrentMapCacheManager) Test(org.junit.Test)

Example 4 with ConcurrentMapCacheManager

use of org.springframework.cache.concurrent.ConcurrentMapCacheManager in project spring-security by spring-projects.

the class SpringCacheBasedTicketCacheTests method initCacheManaer.

// ~ Methods
// ========================================================================================================
@BeforeClass
public static void initCacheManaer() {
    cacheManager = new ConcurrentMapCacheManager();
    cacheManager.getCache("castickets");
}
Also used : ConcurrentMapCacheManager(org.springframework.cache.concurrent.ConcurrentMapCacheManager) BeforeClass(org.junit.BeforeClass)

Example 5 with ConcurrentMapCacheManager

use of org.springframework.cache.concurrent.ConcurrentMapCacheManager in project spring-security by spring-projects.

the class SpringCacheBasedAclCacheTests method initCacheManaer.

@BeforeAll
public static void initCacheManaer() {
    cacheManager = new ConcurrentMapCacheManager();
    // Use disk caching immediately (to test for serialization issue reported in
    // SEC-527)
    cacheManager.getCache("springcasebasedacltests");
}
Also used : ConcurrentMapCacheManager(org.springframework.cache.concurrent.ConcurrentMapCacheManager) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

ConcurrentMapCacheManager (org.springframework.cache.concurrent.ConcurrentMapCacheManager)17 Test (org.junit.jupiter.api.Test)9 LinkedHashMap (java.util.LinkedHashMap)4 CacheEntry (org.springframework.boot.actuate.cache.CachesEndpoint.CacheEntry)4 CacheManager (org.springframework.cache.CacheManager)4 SimpleCacheManager (org.springframework.cache.support.SimpleCacheManager)4 Test (org.junit.Test)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 BeforeAll (org.junit.jupiter.api.BeforeAll)2 CacheManagerDescriptor (org.springframework.boot.actuate.cache.CachesEndpoint.CacheManagerDescriptor)2 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)2 Bean (org.springframework.context.annotation.Bean)2 BeforeClass (org.junit.BeforeClass)1