當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。