本文整理匯總了Java中org.ofbiz.base.util.collections.LifoSet類的典型用法代碼示例。如果您正苦於以下問題:Java LifoSet類的具體用法?Java LifoSet怎麽用?Java LifoSet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
LifoSet類屬於org.ofbiz.base.util.collections包,在下文中一共展示了LifoSet類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: mruAdd
import org.ofbiz.base.util.collections.LifoSet; //導入依賴的package包/類
public static void mruAdd(HttpSession session, GenericEntity pk) {
if (pk == null) {
return;
}
Map<String, LifoSet<Object>> lookupCaches = UtilGenerics.checkMap(session.getAttribute("lookupCaches"));
if (lookupCaches == null) {
lookupCaches = FastMap.newInstance();
session.setAttribute("lookupCaches", lookupCaches);
}
String entityName = pk.getEntityName();
mruAddByEntityName(entityName, pk, lookupCaches);
}
示例2: mruAddByEntityName
import org.ofbiz.base.util.collections.LifoSet; //導入依賴的package包/類
/**
* Makes an entry in the "most recently used" cache. It picks the cache
* by the entity name and builds a signature from the primary key values.
*
* @param entityName
* @param lookupCaches
* @param pk either a GenericValue or GenericPK - populated
*/
public static void mruAddByEntityName(String entityName, GenericEntity pk, Map<String, LifoSet<Object>> lookupCaches) {
String cacheEntityName = entityName;
LifoSet<Object> lkupCache = lookupCaches.get(cacheEntityName);
if (lkupCache == null) {
lkupCache = new LifoSet<Object>();
lookupCaches.put(cacheEntityName, lkupCache);
}
lkupCache.add(pk.getPrimaryKey());
if (Debug.infoOn()) Debug.logInfo("in mruAddByEntityName, entityName:" + entityName + " lifoSet.size()" + lkupCache.size(), module);
}
示例3: mostRecentlyViewedIterator
import org.ofbiz.base.util.collections.LifoSet; //導入依賴的package包/類
public static Iterator<Object> mostRecentlyViewedIterator(String entityName, Map<String, LifoSet<Object>> lookupCaches) {
String cacheEntityName = entityName;
LifoSet<Object> lkupCache = lookupCaches.get(cacheEntityName);
if (lkupCache == null) {
lkupCache = new LifoSet<Object>();
lookupCaches.put(cacheEntityName, lkupCache);
}
Iterator<Object> mrvIterator = lkupCache.iterator();
return mrvIterator;
}