当前位置: 首页>>代码示例>>Java>>正文


Java EhCacheFactoryBean类代码示例

本文整理汇总了Java中org.springframework.cache.ehcache.EhCacheFactoryBean的典型用法代码示例。如果您正苦于以下问题:Java EhCacheFactoryBean类的具体用法?Java EhCacheFactoryBean怎么用?Java EhCacheFactoryBean使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EhCacheFactoryBean类属于org.springframework.cache.ehcache包,在下文中一共展示了EhCacheFactoryBean类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import org.springframework.cache.ehcache.EhCacheFactoryBean; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    this.blockingDhtCache = new BlockingDhtCache();

    EhCacheFactoryBean ehCacheFactoryBean = new EhCacheFactoryBean();
    ehCacheFactoryBean.setCacheName("unittest");
    ehCacheFactoryBean.afterPropertiesSet();
    this.cache = (Cache) ehCacheFactoryBean.getObject();
    this.blockingDhtCache.setCache(this.cache);
    this.dhtClientFactory = mock(DhtClientFactory.class);
    this.blockingDhtCache.setDhtClientFactory(this.dhtClientFactory);
    this.id = mock(PId.class);
    when(this.id.toStringFull()).thenReturn("" + System.currentTimeMillis());
    this.piEntity = mock(PiEntity.class);
    this.blockingReader = mock(BlockingDhtReader.class);
    when(this.dhtClientFactory.createBlockingReader()).thenReturn(this.blockingReader);
    this.blockingWriter = mock(BlockingDhtWriter.class);
    when(this.dhtClientFactory.createBlockingWriter()).thenReturn(this.blockingWriter);
}
 
开发者ID:barnyard,项目名称:pi,代码行数:20,代码来源:BlockingDhtCacheTest.java

示例2: testThatCacheDoesExpire

import org.springframework.cache.ehcache.EhCacheFactoryBean; //导入依赖的package包/类
@Ignore("because this is just testing ehcache which hopefully works anyhow")
@Test
public void testThatCacheDoesExpire() throws Exception {
    // setup
    int ttl = 2;
    EhCacheFactoryBean ehCacheFactoryBean = new EhCacheFactoryBean();
    ehCacheFactoryBean.setCacheName("unittest1");
    ehCacheFactoryBean.setTimeToIdle(ttl);
    ehCacheFactoryBean.setTimeToLive(ttl);
    ehCacheFactoryBean.afterPropertiesSet();
    this.cache = (Cache) ehCacheFactoryBean.getObject();
    this.blockingDhtCache.setCache(this.cache);

    when(this.blockingReader.get(id)).thenReturn(piEntity);

    // act
    PiEntity result = this.blockingDhtCache.get(id);
    assertEquals(this.piEntity, result);
    Thread.sleep(ttl * 2 * 1000);

    result = this.blockingDhtCache.get(id);
    assertEquals(this.piEntity, result);

    // assert
    verify(this.blockingReader, times(2)).get(id);
}
 
开发者ID:barnyard,项目名称:pi,代码行数:27,代码来源:BlockingDhtCacheTest.java

示例3: ehcacheTicketsCache

import org.springframework.cache.ehcache.EhCacheFactoryBean; //导入依赖的package包/类
@Lazy
@Autowired
@Bean
public EhCacheFactoryBean ehcacheTicketsCache(@Qualifier("cacheManager") final CacheManager manager) {
    final EhcacheProperties ehcacheProperties = casProperties.getTicket().getRegistry().getEhcache();
    final EhCacheFactoryBean bean = new EhCacheFactoryBean();
    bean.setCacheName(ehcacheProperties.getCacheName());
    bean.setCacheEventListeners(Collections.singleton(ticketRMISynchronousCacheReplicator()));
    bean.setTimeToIdle(ehcacheProperties.getCacheTimeToIdle());
    bean.setTimeToLive(ehcacheProperties.getCacheTimeToLive());

    bean.setCacheManager(manager);
    bean.setBootstrapCacheLoader(ticketCacheBootstrapCacheLoader());
    bean.setDiskExpiryThreadIntervalSeconds(ehcacheProperties.getDiskExpiryThreadIntervalSeconds());

    bean.setEternal(ehcacheProperties.isEternal());
    bean.setMaxEntriesLocalHeap(ehcacheProperties.getMaxElementsInMemory());
    bean.setMaxEntriesInCache(ehcacheProperties.getMaxElementsInCache());
    bean.setMaxEntriesLocalDisk(ehcacheProperties.getMaxElementsOnDisk());
    bean.setMemoryStoreEvictionPolicy(ehcacheProperties.getMemoryStoreEvictionPolicy());

    final PersistenceConfiguration c = new PersistenceConfiguration();
    c.strategy(ehcacheProperties.getPersistence());
    c.setSynchronousWrites(ehcacheProperties.isSynchronousWrites());
    bean.persistence(c);

    return bean;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:29,代码来源:EhcacheTicketRegistryConfiguration.java

示例4: ehcache

import org.springframework.cache.ehcache.EhCacheFactoryBean; //导入依赖的package包/类
@Bean
public Ehcache ehcache(){
    EhCacheFactoryBean cacheFactoryBean = new EhCacheFactoryBean();
    cacheFactoryBean.setCacheManager(cacheManager());
    cacheFactoryBean.setCacheName("aclCache");
    cacheFactoryBean.setMaxBytesLocalHeap("1M");
    cacheFactoryBean.setMaxEntriesLocalHeap(0L);
    cacheFactoryBean.afterPropertiesSet();
    return cacheFactoryBean.getObject();
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:11,代码来源:AclConfig.java

示例5: clusterEhcache

import org.springframework.cache.ehcache.EhCacheFactoryBean; //导入依赖的package包/类
@Bean
public EhCacheFactoryBean clusterEhcache() {
  EhCacheFactoryBean factory = new EhCacheFactoryBean();
  factory.setCacheName("clusterCache");
  factory.setCacheManager(cacheManager);
  return factory;
}
 
开发者ID:c2mon,项目名称:c2mon,代码行数:8,代码来源:ClusterCacheConfig.java

示例6: alarmEhcache

import org.springframework.cache.ehcache.EhCacheFactoryBean; //导入依赖的package包/类
@Bean
public EhCacheFactoryBean alarmEhcache(CacheManager cacheManager) {
  EhCacheFactoryBean factory = new EhCacheFactoryBean();
  factory.setCacheName("alarmCache");
  factory.setCacheManager(cacheManager);
  return factory;
}
 
开发者ID:c2mon,项目名称:c2mon,代码行数:8,代码来源:AlarmCacheConfig.java

示例7: commandTagEhcache

import org.springframework.cache.ehcache.EhCacheFactoryBean; //导入依赖的package包/类
@Bean
public EhCacheFactoryBean commandTagEhcache(CacheManager cacheManager) {
  EhCacheFactoryBean factory = new EhCacheFactoryBean();
  factory.setCacheName("commandCache");
  factory.setCacheManager(cacheManager);
  return factory;
}
 
开发者ID:c2mon,项目名称:c2mon,代码行数:8,代码来源:CommandTagCacheConfig.java

示例8: deviceEhcache

import org.springframework.cache.ehcache.EhCacheFactoryBean; //导入依赖的package包/类
@Bean
public EhCacheFactoryBean deviceEhcache(CacheManager cacheManager) {
  EhCacheFactoryBean factory = new EhCacheFactoryBean();
  factory.setCacheName("deviceCache");
  factory.setCacheManager(cacheManager);
  return factory;
}
 
开发者ID:c2mon,项目名称:c2mon,代码行数:8,代码来源:DeviceCacheConfig.java

示例9: processEhcache

import org.springframework.cache.ehcache.EhCacheFactoryBean; //导入依赖的package包/类
@Bean
public EhCacheFactoryBean processEhcache(CacheManager cacheManager) {
  EhCacheFactoryBean factory = new EhCacheFactoryBean();
  factory.setCacheName("processCache");
  factory.setCacheManager(cacheManager);
  return factory;
}
 
开发者ID:c2mon,项目名称:c2mon,代码行数:8,代码来源:ProcessCacheConfig.java

示例10: deviceClassEhcache

import org.springframework.cache.ehcache.EhCacheFactoryBean; //导入依赖的package包/类
@Bean
public EhCacheFactoryBean deviceClassEhcache(CacheManager cacheManager) {
  EhCacheFactoryBean factory = new EhCacheFactoryBean();
  factory.setCacheName("deviceClassCache");
  factory.setCacheManager(cacheManager);
  return factory;
}
 
开发者ID:c2mon,项目名称:c2mon,代码行数:8,代码来源:DeviceClassCacheConfig.java

示例11: dataTagEhcache

import org.springframework.cache.ehcache.EhCacheFactoryBean; //导入依赖的package包/类
@Bean
public EhCacheFactoryBean dataTagEhcache(CacheManager cacheManager) {
  EhCacheFactoryBean factory = new EhCacheFactoryBean();
  factory.setCacheName("tagCache");
  factory.setCacheManager(cacheManager);
  return factory;
}
 
开发者ID:c2mon,项目名称:c2mon,代码行数:8,代码来源:DataTagCacheConfig.java

示例12: ruleTagEhcache

import org.springframework.cache.ehcache.EhCacheFactoryBean; //导入依赖的package包/类
@Bean
public EhCacheFactoryBean ruleTagEhcache(CacheManager cacheManager) {
  EhCacheFactoryBean factory = new EhCacheFactoryBean();
  factory.setCacheName("ruleCache");
  factory.setCacheManager(cacheManager);
  return factory;
}
 
开发者ID:c2mon,项目名称:c2mon,代码行数:8,代码来源:RuleTagCacheConfig.java

示例13: controlTagEhcache

import org.springframework.cache.ehcache.EhCacheFactoryBean; //导入依赖的package包/类
@Bean
public EhCacheFactoryBean controlTagEhcache(CacheManager cacheManager) {
  EhCacheFactoryBean factory = new EhCacheFactoryBean();
  factory.setCacheName("controlCache");
  factory.setCacheManager(cacheManager);
  return factory;
}
 
开发者ID:c2mon,项目名称:c2mon,代码行数:8,代码来源:ControlTagCacheConfig.java

示例14: equipmentEhcache

import org.springframework.cache.ehcache.EhCacheFactoryBean; //导入依赖的package包/类
@Bean
public EhCacheFactoryBean equipmentEhcache(CacheManager cacheManager) {
  EhCacheFactoryBean factory = new EhCacheFactoryBean();
  factory.setCacheName("equipmentCache");
  factory.setCacheManager(cacheManager);
  return factory;
}
 
开发者ID:c2mon,项目名称:c2mon,代码行数:8,代码来源:EquipmentCacheConfig.java

示例15: subEquipmentEhcache

import org.springframework.cache.ehcache.EhCacheFactoryBean; //导入依赖的package包/类
@Bean
public EhCacheFactoryBean subEquipmentEhcache(CacheManager cacheManager) {
  EhCacheFactoryBean factory = new EhCacheFactoryBean();
  factory.setCacheName("subEquipmentCache");
  factory.setCacheManager(cacheManager);
  return factory;
}
 
开发者ID:c2mon,项目名称:c2mon,代码行数:8,代码来源:SubEquipmentCacheConfig.java


注:本文中的org.springframework.cache.ehcache.EhCacheFactoryBean类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。