14 Nisan 2023 Cuma

SpringCache SimpleCacheManager Sınıfı

Giriş
Şu satırı dahil ederiz
import  org.springframework.cache.support.SimpleCacheManager;
Örnek
Şöyle yaparız
@Configuration
@EnableCaching
public class CachingConfig {

  @Bean
  public CacheManager cacheManager() {
    SimpleCacheManager cacheManager = new SimpleCacheManager();
    cacheManager.setCaches(Arrays.asList(
      new ConcurrentMapCache("directory"), 
      new ConcurrentMapCache("addresses")));
    return cacheManager;
  }
}
Örnek
Şöyle yaparız.
<bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">
  <property name="caches">
    <set>
      <bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean"
         p:name="foo"/>
    </set>
  </property>
</bean>

Hiç yorum yok:

Yorum Gönder