org.infinispan.configuration.cache.Configuration.expiration()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(164)

本文整理了Java中org.infinispan.configuration.cache.Configuration.expiration()方法的一些代码示例,展示了Configuration.expiration()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.expiration()方法的具体详情如下:
包路径:org.infinispan.configuration.cache.Configuration
类名称:Configuration
方法名:expiration

Configuration.expiration介绍

暂无

代码示例

代码示例来源:origin: org.exoplatform.kernel/exo.kernel.component.ext.cache.impl.infinispan.v5

@ManagedName("Lifespan")
@ManagedDescription("Maximum lifespan of a cache entry, after which the entry is expired cluster-wide."
  + " -1 means the entries never expire.")
public long getLiveTime()
{
  return cache.getCacheConfiguration().expiration().lifespan();
}

代码示例来源:origin: org.exoplatform.kernel/exo.kernel.component.ext.cache.impl.infinispan.v5

@ManagedName("Lifespan")
@ManagedDescription("Maximum lifespan of a cache entry, after which the entry is expired cluster-wide."
 + " -1 means the entries never expire.")
public long getLiveTime()
{
 return cache.getCacheConfiguration().expiration().lifespan();
}

代码示例来源:origin: org.infinispan/infinispan-cdi-embedded

public void testQuickCache() {
   assertEquals(quickCache.getCacheConfiguration().expiration().wakeUpInterval(), 1);
  }
}

代码示例来源:origin: org.infinispan/infinispan-cdi

public void testQuickCache() {
   assertEquals(quickCache.getCacheConfiguration().expiration().wakeUpInterval(), 1);
  }
}

代码示例来源:origin: org.exoplatform.kernel/exo.kernel.component.ext.cache.impl.infinispan.v5

@Managed
@ManagedName("MaxIdle")
@ManagedDescription("Maximum idle time a cache entry will be maintained in the cache. "
 + "If the idle time is exceeded, the entry will be expired cluster-wide. -1 means the entries never expire.")
public long getMaxIdle()
{
 return cache.getCacheConfiguration().expiration().maxIdle();
}

代码示例来源:origin: org.exoplatform.kernel/exo.kernel.component.ext.cache.impl.infinispan.v5

@Managed
@ManagedName("WakeUpInterval")
@ManagedDescription("Interval between subsequent eviction runs. If you wish to disable the periodic eviction "
 + "process altogether, set wakeupInterval to -1.")
public long getWakeUpInterval()
{
 return cache.getCacheConfiguration().expiration().wakeUpInterval();
}

代码示例来源:origin: org.exoplatform.kernel/exo.kernel.component.ext.cache.impl.infinispan.v5

@Managed
@ManagedName("MaxIdle")
@ManagedDescription("Maximum idle time a cache entry will be maintained in the cache. "
  + "If the idle time is exceeded, the entry will be expired cluster-wide. -1 means the entries never expire.")
public long getMaxIdle()
{
  return cache.getCacheConfiguration().expiration().maxIdle();
}

代码示例来源:origin: org.exoplatform.kernel/exo.kernel.component.ext.cache.impl.infinispan.v5

@Managed
 @ManagedName("WakeUpInterval")
 @ManagedDescription("Interval between subsequent eviction runs. If you wish to disable the periodic eviction "
   + "process altogether, set wakeupInterval to -1.")
 public long getWakeUpInterval()
 {
   return cache.getCacheConfiguration().expiration().wakeUpInterval();
 }
}

代码示例来源:origin: org.infinispan/infinispan-core

@Override
public void call() {
 Configuration wildcache1 = cm.getCacheConfiguration("wildcache1");
 assertNotNull(wildcache1);
 assertEquals(10500, wildcache1.expiration().wakeUpInterval());
 assertEquals(11, wildcache1.expiration().lifespan());
 assertEquals(11, wildcache1.expiration().maxIdle());
}

代码示例来源:origin: org.infinispan/infinispan-cdi

public void testQuickCache() {
   assertEquals(quickCache.getCacheConfiguration().eviction().maxEntries(), 1000);
   assertEquals(quickCache.getCacheConfiguration().expiration().wakeUpInterval(), 1);
  }
}

代码示例来源:origin: org.infinispan/infinispan-jcache

public void testJCacheManagerWithWildcardCacheConfigurations() throws Exception {
 URI uri = JCacheConfigurationTest.class.getClassLoader().getResource("infinispan_uri.xml").toURI();
 withCachingProvider(provider -> {
   JCacheManager jCacheManager = new JCacheManager(
      uri,
      provider.getClass().getClassLoader(),
      provider,
      null);
   Cache<Object, Object> wildcache1 = jCacheManager.createCache("wildcache1", new MutableConfiguration<>());
   org.infinispan.Cache unwrap = wildcache1.unwrap(org.infinispan.Cache.class);
   Configuration configuration = unwrap.getCacheConfiguration();
   assertEquals(10500, configuration.expiration().wakeUpInterval());
   assertEquals(11, configuration.expiration().lifespan());
   assertEquals(11, configuration.expiration().maxIdle());
 });
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

private static Cache<?, ?> checkValidConfiguration(final Cache<?, ?> cache, String indexName) {
 Configuration configuration = cache.getCacheConfiguration();
 if (configuration.expiration().maxIdle() != -1) {
   throw log.luceneStorageHavingIdleTimeSet(indexName, cache.getName());
 }
 if (configuration.expiration().lifespan() != -1) {
   throw log.luceneStorageHavingLifespanSet(indexName, cache.getName());
 }
 if (configuration.memory().storageType() == StorageType.BINARY) {
   throw log.luceneStorageAsBinaryEnabled(indexName, cache.getName());
 }
 if (!Configurations.noDataLossOnJoiner(configuration)) {
   throw log.luceneStorageNoStateTransferEnabled(indexName, cache.getName());
 }
 return cache;
}

代码示例来源:origin: org.infinispan/infinispan-lucene-directory

private static Cache<?, ?> checkValidConfiguration(final Cache<?, ?> cache, String indexName) {
 Configuration configuration = cache.getCacheConfiguration();
 if (configuration.expiration().maxIdle() != -1) {
   throw log.luceneStorageHavingIdleTimeSet(indexName, cache.getName());
 }
 if (configuration.expiration().lifespan() != -1) {
   throw log.luceneStorageHavingLifespanSet(indexName, cache.getName());
 }
 if (configuration.memory().storageType() == StorageType.BINARY) {
   throw log.luceneStorageAsBinaryEnabled(indexName, cache.getName());
 }
 if (!Configurations.noDataLossOnJoiner(configuration)) {
   throw log.luceneStorageNoStateTransferEnabled(indexName, cache.getName());
 }
 return cache;
}

代码示例来源:origin: org.infinispan/infinispan-hibernate-cache-commons

@Test
public void testCustomPendingPutsCache() {
  Properties p = createProperties();
  p.setProperty(INFINISPAN_CONFIG_RESOURCE_PROP, "alternative-infinispan-configs.xml");
  TestRegionFactory factory = createRegionFactory(p);
  try {
    Configuration ppConfig = factory.getCacheManager().getCacheConfiguration(DEF_PENDING_PUTS_RESOURCE);
    assertEquals(120000, ppConfig.expiration().maxIdle());
  } finally {
    factory.stop();
  }
}

代码示例来源:origin: org.infinispan/infinispan-hibernate-cache-commons

@Test
public void testBuildTimestampsRegionWithNoneEvictionOverride() {
  final String timestamps = "org.hibernate.cache.spi.UpdateTimestampsCache";
  final String timestampsNoEviction = "timestamps-no-eviction";
  Properties p = createProperties();
  p.setProperty("hibernate.cache.infinispan.timestamps.cfg", timestampsNoEviction);
  p.setProperty("hibernate.cache.infinispan.timestamps.memory.size", "0");
  p.setProperty("hibernate.cache.infinispan.timestamps.expiration.wake_up_interval", "3000");
  TestRegionFactory factory = createRegionFactory(p);
  try {
    InfinispanBaseRegion region = factory.buildTimestampsRegion(timestamps);
    assertTrue( isDefinedCache(factory, timestamps) );
    assertEquals(3000, region.getCache().getCacheConfiguration().expiration().wakeUpInterval());
  } finally {
    factory.stop();
  }
}

代码示例来源:origin: org.infinispan/infinispan-cdi-embedded

public void testQuickCache() {
   assertEquals(quickCache.getCacheConfiguration().memory().size(), 1000);
   assertEquals(quickCache.getCacheConfiguration().expiration().wakeUpInterval(), 1);
  }
}

代码示例来源:origin: org.infinispan/infinispan-hibernate-cache-commons

@Override
protected void startUp() {
 super.startUp();
 TestRegionFactory regionFactory = TestRegionFactoryProvider.load().wrap(sessionFactory().getSettings().getRegionFactory());
 TIMEOUT = regionFactory.getPendingPutsCacheConfiguration().expiration().maxIdle();
 region = TEST_SESSION_ACCESS.getRegion(sessionFactory(), Item.class.getName());
 entityCache = region.getCache();
}

代码示例来源:origin: org.infinispan/infinispan-server-memcached

@Override
protected void startInternal(MemcachedServerConfiguration configuration, EmbeddedCacheManager cacheManager) {
 if (cacheManager.getCacheConfiguration(configuration.defaultCacheName()) == null) {
   // Define the Memcached cache as clone of the default one
   cacheManager.defineConfiguration(configuration.defaultCacheName(),
    new ConfigurationBuilder().read(cacheManager.getDefaultCacheConfiguration()).build());
 }
 ExpirationConfiguration expConfig = cacheManager.getCacheConfiguration(configuration.defaultCacheName()).expiration();
 if (expConfig.lifespan() >= 0 || expConfig.maxIdle() >= 0)
  throw log.invalidExpiration(configuration.defaultCacheName());
 Cache<byte[], byte[]> cache = cacheManager.getCache(configuration.defaultCacheName());
 memcachedCache = cache.getAdvancedCache();
 super.startInternal(configuration, cacheManager);
}

代码示例来源:origin: org.infinispan/infinispan-hibernate-cache-commons

@Before
public void insertAndClearCache() throws Exception {
 region = TEST_SESSION_ACCESS.getRegion(sessionFactory(), Item.class.getName());
 entityCache = region.getCache();
 timeout = TestRegionFactoryProvider.load().findRegionFactory(sessionFactory().getCache())
    .getPendingPutsCacheConfiguration().expiration().maxIdle();
 Item item = new Item("my item", "Original item");
 withTxSession(s -> s.persist(item));
 entityCache.clear();
 assertEquals("Cache is not empty", Collections.EMPTY_SET, entityCache.keySet());
 itemId = item.getId();
 log.info("Insert and clear finished");
}

代码示例来源:origin: org.infinispan/infinispan-hibernate-cache-commons

@Test
public void testDefaultPendingPutsCache() {
  Properties p = createProperties();
  TestRegionFactory factory = createRegionFactory(p);
  try {
    Configuration ppConfig = factory.getCacheManager().getCacheConfiguration(DEF_PENDING_PUTS_RESOURCE);
    assertTrue(ppConfig.isTemplate());
    assertFalse(ppConfig.clustering().cacheMode().isClustered());
    assertTrue(ppConfig.simpleCache());
    assertEquals(TransactionMode.NON_TRANSACTIONAL, ppConfig.transaction().transactionMode());
    assertEquals(60000, ppConfig.expiration().maxIdle());
    assertFalse(ppConfig.jmxStatistics().enabled());
    assertFalse(ppConfig.jmxStatistics().available());
  } finally {
    factory.stop();
  }
}

相关文章