Package org.springframework.cache

Examples of org.springframework.cache.Cache


  }


  public Cache getCache(String name) {
    for (CacheManager cacheManager : this.cacheManagers) {
      Cache cache = cacheManager.getCache(name);
      if (cache != null) {
        return cache;
      }
    }
    return null;
View Full Code Here


  /**
   * This implementation always returns a {@link Cache} implementation that will not store items.
   * Additionally, the request cache will be remembered by the manager for consistency.
   */
  public Cache getCache(String name) {
    Cache cache = this.caches.get(name);
    if (cache == null) {
      this.caches.putIfAbsent(name, new NoOpCache(name));
      synchronized (this.cacheNames) {
        this.cacheNames.add(name);
      }
View Full Code Here

    return caches;
  }

  @Override
  public Cache getCache(String name) {
    Cache cache = super.getCache(name);
    if (cache == null) {
      // check the EhCache cache again
      // (in case the cache was added at runtime)
      Ehcache ehcache = this.cacheManager.getEhcache(name);
      if (ehcache != null) {
View Full Code Here

    return caches;
  }

  @Override
  public Cache getCache(String name) {
    Cache cache = super.getCache(name);
    if (cache == null) {
      // check the JCache cache again
      // (in case the cache was added at runtime)
      javax.cache.Cache<?,?> jcache = this.cacheManager.getCache(name);
      if (jcache != null) {
View Full Code Here

   *
   *  This implementation always returns a {@link Cache} implementation that will not
   *  store items. Additionally, the request cache will be remembered by the manager for consistency.
   */
  public Cache getCache(String name) {
    Cache cache = caches.get(name);
    if (cache == null) {
      caches.putIfAbsent(name, new NoOpCache(name));
      synchronized (names) {
        names.add(name);
      }
View Full Code Here

  public Collection<String> getCacheNames() {
    return Collections.unmodifiableSet(this.cacheMap.keySet());
  }

  public Cache getCache(String name) {
    Cache cache = this.cacheMap.get(name);
    if (cache == null && this.dynamic) {
      synchronized (this.cacheMap) {
        cache = this.cacheMap.get(name);
        if (cache == null) {
          cache = createConcurrentMapCache(name);
View Full Code Here

    return caches;
  }

  @Override
  public Cache getCache(String name) {
    Cache cache = super.getCache(name);
    if (cache == null) {
      // check the EhCache cache again
      // (in case the cache was added at runtime)
      Ehcache ehcache = this.cacheManager.getEhcache(name);
      if (ehcache != null) {
View Full Code Here

    }

    @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

  protected Collection<Cache> getCaches(CacheOperation operation) {
    Set<String> cacheNames = operation.getCacheNames();
    Collection<Cache> caches = new ArrayList<Cache>(cacheNames.size());
    for (String name : cacheNames) {
      Cache cache = getCacheManager().getCache(name);
      if (cache == null) {
        throw new IllegalArgumentException("Cannot find cache named [" + name + "] for " + operation);
      }
      caches.add(cache);
    }
View Full Code Here

  public Collection<String> getCacheNames() {
    return Collections.unmodifiableSet(cacheMap.keySet());
  }

  public Cache getCache(String name) {
    Cache cache = cacheMap.get(name);
    if (cache == null) {
      cache = createConcurrentMapCache(name);
      Cache existing = cacheMap.putIfAbsent(name, cache);
      if (existing != null) {
        cache = existing;
      }
    }
    return cache;
View Full Code Here

TOP

Related Classes of org.springframework.cache.Cache

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.