本文整理汇总了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;
}