Package org.springframework.cache.concurrent

Examples of org.springframework.cache.concurrent.ConcurrentMapCache


    }

    @Bean
    public CacheManager cacheManager() throws Exception {
        SimpleCacheManager scm = new SimpleCacheManager();
        Cache cache = new ConcurrentMapCache("customers");
        scm.setCaches(Arrays.asList(cache));
        return scm;
    }
View Full Code Here


        if (cacheSize >= 0) {
            cacheBuilder.maximumSize(cacheSize);
        }
        ConcurrentMap<Object, Object> map = cacheBuilder.build().asMap();
        return new ConcurrentMapCache(name, map, false);
    }
View Full Code Here

    @Bean
    public CacheManager cacheManager() {
      SimpleCacheManager mgr = new SimpleCacheManager();
      ArrayList<Cache> caches = new ArrayList<Cache>();
      caches.add(new ConcurrentMapCache(""));
      mgr.setCaches(caches);
      return mgr;
    }
View Full Code Here

  private boolean hasCssLinkTransformer;


  public ResourceChainRegistration(boolean cacheResources) {
    this(cacheResources, cacheResources ? new ConcurrentMapCache(DEFAULT_CACHE_NAME) : null);
  }
View Full Code Here

   */
  public static CacheManager createSimpleCacheManager(String... cacheNames) {
    SimpleCacheManager result = new SimpleCacheManager();
    List<Cache> caches = new ArrayList<Cache>();
    for (String cacheName : cacheNames) {
      caches.add(new ConcurrentMapCache(cacheName));
    }
    result.setCaches(caches);
    result.afterPropertiesSet();
    return result;
  }
View Full Code Here

      return cacheManager;
    }

    @Bean
    public Cache cache() {
      Cache cache = new ConcurrentMapCache("cache");
      return Mockito.spy(cache);
    }
View Full Code Here

  public void testMultipleCachingEval() throws Exception {
    AnnotatedClass target = new AnnotatedClass();
    Method method = ReflectionUtils.findMethod(AnnotatedClass.class, "multipleCaching", Object.class,
        Object.class);
    Object[] args = new Object[] { new Object(), new Object() };
    Collection<ConcurrentMapCache> caches = Collections.singleton(new ConcurrentMapCache("test"));

    EvaluationContext evalCtx = eval.createEvaluationContext(caches, method, args, target, target.getClass());
    Collection<CacheOperation> ops = getOps("multipleCaching");

    Iterator<CacheOperation> it = ops.iterator();
View Full Code Here

  private EvaluationContext createEvaluationContext(Object result) {
    AnnotatedClass target = new AnnotatedClass();
    Method method = ReflectionUtils.findMethod(AnnotatedClass.class, "multipleCaching", Object.class,
        Object.class);
    Object[] args = new Object[] { new Object(), new Object() };
    Collection<ConcurrentMapCache> caches = Collections.singleton(new ConcurrentMapCache("test"));
    EvaluationContext context = eval.createEvaluationContext(caches, method, args, target, target.getClass(), result);
    return context;
  }
View Full Code Here

  public static class TestPathHelper extends UrlPathHelper { }

  public static class TestCacheManager implements CacheManager {
    @Override
    public Cache getCache(String name) {
      return new ConcurrentMapCache(name);
    }
View Full Code Here


  @Before
  public void setup() {

    this.cache = new ConcurrentMapCache("resourceCache");

    List<ResourceResolver> resolvers = new ArrayList<>();
    resolvers.add(new CachingResourceResolver(this.cache));
    resolvers.add(new PathResourceResolver());
    this.chain = new DefaultResourceResolverChain(resolvers);
View Full Code Here

TOP

Related Classes of org.springframework.cache.concurrent.ConcurrentMapCache

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.