Ejemplo n.º 1
0
 @Bean
 public CacheManager getCacheManager() {
   SimpleCacheManager cacheManager = new SimpleCacheManager();
   List<Cache> caches = new ArrayList<>();
   caches.add(new ConcurrentMapCache("locationsByLevel"));
   caches.add(new ConcurrentMapCache("locationsByCode"));
   caches.add(new ConcurrentMapCache("locationsById"));
   caches.add(new ConcurrentMapCache("locationsByParams"));
   caches.add(new ConcurrentMapCache("findLocationsByParentId"));
   caches.add(new ConcurrentMapCache("locationsByLevelUacsNotNull"));
   caches.add(new ConcurrentMapCache("findLocationsByParamsTypeStatus"));
   caches.add(new ConcurrentMapCache("countLocationProjectsByParams"));
   caches.add(new ConcurrentMapCache("shapesWithDetail"));
   caches.add(new ConcurrentMapCache("locationWithTransactionStats"));
   caches.add(new ConcurrentMapCache("locationWithProjectStats"));
   caches.add(new ConcurrentMapCache("getProjectStats"));
   caches.add(new ConcurrentMapCache("findProjectsByParams"));
   caches.add(new ConcurrentMapCache("findProjectMiniByParams"));
   caches.add(new ConcurrentMapCache("findProjectsById"));
   caches.add(new ConcurrentMapCache("findFundingAgencyById"));
   caches.add(new ConcurrentMapCache("findFundingAgencyByParams"));
   caches.add(new ConcurrentMapCache("findFundingAgencyByParamsWithProjectStats"));
   caches.add(new ConcurrentMapCache("findImplementingAgencyById"));
   caches.add(new ConcurrentMapCache("findImplementingAgencyByParams"));
   caches.add(new ConcurrentMapCache("findImplementingAgencyByParamsWithProjectStats"));
   caches.add(new ConcurrentMapCache("findSectorById"));
   caches.add(new ConcurrentMapCache("findSectorByParams"));
   caches.add(new ConcurrentMapCache("findSectorByParamsWithProjectStats"));
   caches.add(new ConcurrentMapCache("findPhysicalStatusById"));
   caches.add(new ConcurrentMapCache("findPhysicalStatusByParams"));
   caches.add(new ConcurrentMapCache("findPhysicalStatusByParamsWithProjectStats"));
   cacheManager.setCaches(caches);
   return cacheManager;
 }
Ejemplo n.º 2
0
 @Bean
 public CacheManager cacheManager() {
   // configure and return an implementation of Spring's CacheManager SPI
   SimpleCacheManager cacheManager = new SimpleCacheManager();
   cacheManager.setCaches(Arrays.asList(cache()));
   return cacheManager;
 }
 @Test
 public void genericCacheExplicitWithCaches() {
   load(GenericCacheConfiguration.class, "spring.cache.type=generic");
   SimpleCacheManager cacheManager = validateCacheManager(SimpleCacheManager.class);
   assertThat(cacheManager.getCache("first"), equalTo(this.context.getBean("firstCache")));
   assertThat(cacheManager.getCache("second"), equalTo(this.context.getBean("secondCache")));
   assertThat(cacheManager.getCacheNames(), hasSize(2));
 }
 protected 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;
 }
  @Bean
  @Profile("local")
  public CacheManager createSimpleCacheManager() {
    SimpleCacheManager simpleCacheManager = new SimpleCacheManager();
    List<Cache> caches = new ArrayList<>(2);
    caches.add(new ConcurrentMapCache("CacheCluster"));
    caches.add(new ConcurrentMapCache("GitHubSourceCode"));
    simpleCacheManager.setCaches(caches);

    return simpleCacheManager;
  }
  @Bean
  public CacheManager cacheManager() {
    SimpleCacheManager cacheManager = new SimpleCacheManager();
    List<GuavaCache> caches = new ArrayList<>();
    for (String cacheName :
        new String[] {"episodes", "episodes-next", "episodes-last", "episodes-lastweek"}) {
      caches.add(
          new GuavaCache(
              cacheName,
              CacheBuilder.newBuilder()
                  .expireAfterWrite(2, TimeUnit.MINUTES)
                  .recordStats()
                  .build()));
    }
    for (String cacheName :
        new String[] {
          "feed-tilos-type-format",
          "feed-weekly-type",
          "feed-show",
          "feed-tilos",
          "feed-tilos-type",
          "feed-weekly",
          "m3u"
        }) {
      caches.add(
          new GuavaCache(
              cacheName,
              CacheBuilder.newBuilder()
                  .expireAfterWrite(5, TimeUnit.MINUTES)
                  .recordStats()
                  .build()));
    }
    cacheManager.setCaches(caches);

    return cacheManager;
  }
 @Bean
 public CacheManager cacheManager() {
   SimpleCacheManager cacheManager = new SimpleCacheManager();
   cacheManager.setCaches(Collections.singletonList(cache()));
   return cacheManager;
 }