Java 类net.sf.ehcache.config.SizeOfPolicyConfiguration 实例源码

项目:sdcct    文件:CacheManagerFactoryBean.java   
@Override
public EhCacheCacheManager getObject() throws Exception {
    if (this.config.getName() == null) {
        this.config.setName(this.beanName);
    }

    this.config.addSizeOfPolicy(new SizeOfPolicyConfiguration().maxDepth(Integer.MAX_VALUE));

    Optional.ofNullable(this.maxBytesLocalDisk).ifPresent(this.config::setMaxBytesLocalDisk);
    Optional.ofNullable(this.maxBytesLocalHeap).ifPresent(this.config::setMaxBytesLocalHeap);
    Optional.ofNullable(this.maxBytesLocalOffHeap).ifPresent(this.config::setMaxBytesLocalOffHeap);

    (this.cacheManager = new EhCacheCacheManager(new CacheManager(this.config))).setTransactionAware(true);

    return this.cacheManager;
}
项目:crigtt    文件:CrigttCacheManagerFactoryBean.java   
@Override
public EhCacheCacheManager getObject() throws Exception {
    if (this.config.getName() == null) {
        this.config.setName(this.beanName);
    }

    this.config.addSizeOfPolicy(new SizeOfPolicyConfiguration().maxDepth(Integer.MAX_VALUE));

    Optional.ofNullable(this.maxBytesLocalDisk).ifPresent(this.config::setMaxBytesLocalDisk);
    Optional.ofNullable(this.maxBytesLocalHeap).ifPresent(this.config::setMaxBytesLocalHeap);
    Optional.ofNullable(this.maxBytesLocalOffHeap).ifPresent(this.config::setMaxBytesLocalOffHeap);

    return (this.manager = new EhCacheCacheManager(new CacheManager(this.config)));
}
项目:jooby    文件:ConfigurationBuilderTest.java   
@Test
public void sizeOfPolicy() {

  Config config = ConfigFactory.empty()
      .withValue("sizeOfPolicy.maxDepth", fromAnyRef(100))
      .withValue("sizeOfPolicy.maxDepthExceededBehavior", fromAnyRef("abort"));


  Configuration eh = new ConfigurationBuilder().build(config);
  SizeOfPolicyConfiguration size = eh.getSizeOfPolicyConfiguration();
  assertEquals(100, size.getMaxDepth());
  assertEquals(MaxDepthExceededBehavior.ABORT, size.getMaxDepthExceededBehavior());
}
项目:jooby    文件:CacheConfigurationBuilderTest.java   
@Test
public void sizeOfPolicy() {
  Config config = ConfigFactory
      .empty()
      .withValue("sizeOfPolicy.maxDepth", fromAnyRef(100))
      .withValue("sizeOfPolicy.maxDepthExceededBehavior", fromAnyRef("abort"));

  CacheConfigurationBuilder builder = new CacheConfigurationBuilder("c1");
  CacheConfiguration cache = builder.build(config);

  SizeOfPolicyConfiguration size = cache.getSizeOfPolicyConfiguration();
  assertEquals(100, size.getMaxDepth());
  assertEquals(MaxDepthExceededBehavior.ABORT, size.getMaxDepthExceededBehavior());
}