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


Java Ehcache.getKeys方法代码示例

本文整理汇总了Java中net.sf.ehcache.Ehcache.getKeys方法的典型用法代码示例。如果您正苦于以下问题:Java Ehcache.getKeys方法的具体用法?Java Ehcache.getKeys怎么用?Java Ehcache.getKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.ehcache.Ehcache的用法示例。


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

示例1: keys

import net.sf.ehcache.Ehcache; //导入方法依赖的package包/类
@Override
public Set keys() {
    if(springCache.getNativeCache() instanceof Ehcache) {
        Ehcache ehcache = (Ehcache) springCache.getNativeCache();
        return new HashSet(ehcache.getKeys());
    }
    throw new UnsupportedOperationException("invoke spring cache abstract keys method not supported");
}
 
开发者ID:liaojiacan,项目名称:zkAdmin,代码行数:9,代码来源:SpringCacheManagerWrapper.java

示例2: keys

import net.sf.ehcache.Ehcache; //导入方法依赖的package包/类
@Override
public Set keys() {
	if (springCache.getNativeCache() instanceof Ehcache) {
		Ehcache ehcache = (Ehcache) springCache.getNativeCache();
		return new HashSet(ehcache.getKeys());
	}
	throw new UnsupportedOperationException(
			"invoke spring cache abstract keys method not supported");
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:10,代码来源:SpringCacheManager.java

示例3: keys

import net.sf.ehcache.Ehcache; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public Set<K> keys() {
       if(cache.getNativeCache() instanceof Ehcache) {
           Ehcache ehcache = (Ehcache) cache.getNativeCache();
           return new HashSet<K>(ehcache.getKeys());
       }
       throw new UnsupportedOperationException("invoke spring cache abstract keys method not supported");
   }
 
开发者ID:wjggwm,项目名称:webside,代码行数:9,代码来源:EhcacheShiroCache.java

示例4: keys

import net.sf.ehcache.Ehcache; //导入方法依赖的package包/类
@Override
public Set keys() {
    if (springCache.getNativeCache() instanceof Ehcache) {
        Ehcache ehcache = (Ehcache) springCache.getNativeCache();
        return new HashSet(ehcache.getKeys());
    }
    throw new UnsupportedOperationException("invoke spring cache abstract keys method not supported");
}
 
开发者ID:ansafari,项目名称:melon,代码行数:9,代码来源:SpringCacheManagerWrapper.java

示例5: updateHits

import net.sf.ehcache.Ehcache; //导入方法依赖的package包/类
/**
 * 更新点击数
 */
@SuppressWarnings("unchecked")
private void updateHits() {
	Ehcache cache = cacheManager.getEhcache(Article.HITS_CACHE_NAME);
	List<Long> ids = cache.getKeys();
	for (Long id : ids) {
		Article article = articleDao.find(id);
		if (article != null) {
			Element element = cache.get(id);
			long hits = (Long) element.getObjectValue();
			article.setHits(hits);
			articleDao.merge(article);
		}
	}
}
 
开发者ID:justinbaby,项目名称:my-paper,代码行数:18,代码来源:ArticleServiceImpl.java

示例6: updateHits

import net.sf.ehcache.Ehcache; //导入方法依赖的package包/类
/**
 * 更新点击数
 */
@SuppressWarnings("unchecked")
private void updateHits() {
	Ehcache cache = cacheManager.getEhcache(Product.HITS_CACHE_NAME);
	List<Long> ids = cache.getKeys();
	for (Long id : ids) {
		Product product = productDao.find(id);
		if (product != null) {
			productDao.lock(product, LockModeType.PESSIMISTIC_WRITE);
			Element element = cache.get(id);
			long hits = (Long) element.getObjectValue();
			long increment = hits - product.getHits();
			Calendar nowCalendar = Calendar.getInstance();
			Calendar weekHitsCalendar = DateUtils.toCalendar(product.getWeekHitsDate());
			Calendar monthHitsCalendar = DateUtils.toCalendar(product.getMonthHitsDate());
			if (nowCalendar.get(Calendar.YEAR) != weekHitsCalendar.get(Calendar.YEAR) || nowCalendar.get(Calendar.WEEK_OF_YEAR) > weekHitsCalendar.get(Calendar.WEEK_OF_YEAR)) {
				product.setWeekHits(increment);
			} else {
				product.setWeekHits(product.getWeekHits() + increment);
			}
			if (nowCalendar.get(Calendar.YEAR) != monthHitsCalendar.get(Calendar.YEAR) || nowCalendar.get(Calendar.MONTH) > monthHitsCalendar.get(Calendar.MONTH)) {
				product.setMonthHits(increment);
			} else {
				product.setMonthHits(product.getMonthHits() + increment);
			}
			product.setHits(hits);
			product.setWeekHitsDate(new Date());
			product.setMonthHitsDate(new Date());
			productDao.merge(product);
		}
	}
}
 
开发者ID:justinbaby,项目名称:my-paper,代码行数:35,代码来源:ProductServiceImpl.java

示例7: keys

import net.sf.ehcache.Ehcache; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public Set keys() {
          if(springCache.getNativeCache() instanceof Ehcache) {
              Ehcache ehcache = (Ehcache) springCache.getNativeCache();
              return new HashSet(ehcache.getKeys());
          }
          throw new UnsupportedOperationException("invoke spring cache abstract keys method not supported");
      }
 
开发者ID:zjlywjh001,项目名称:PhrackCTF-Platform-Team,代码行数:9,代码来源:SpringCacheManagerWrapper.java


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