Example usage for org.springframework.cache.concurrent ConcurrentMapCache ConcurrentMapCache

List of usage examples for org.springframework.cache.concurrent ConcurrentMapCache ConcurrentMapCache

Introduction

In this page you can find the example usage for org.springframework.cache.concurrent ConcurrentMapCache ConcurrentMapCache.

Prototype

public ConcurrentMapCache(String name, ConcurrentMap<Object, Object> store, boolean allowNullValues) 

Source Link

Document

Create a new ConcurrentMapCache with the specified name and the given internal ConcurrentMap to use.

Usage

From source file:org.icgc.dcc.metadata.server.config.CacheConfig.java

@Override
public CacheManager cacheManager() {
    return new ConcurrentMapCacheManager() {

        @Override//from w  ww .j a v a 2s  . c  o m
        protected Cache createConcurrentMapCache(String name) {
            return new ConcurrentMapCache(name, createStore(), false);
        }

        /**
         * @return Guava cache instance with a suitable TTL.
         */
        private ConcurrentMap<Object, Object> createStore() {
            return CacheBuilder.newBuilder().expireAfterWrite(CACHE_TTL_MINUTES, MINUTES).maximumSize(100)
                    .build().asMap();
        }

    };
}