本文整理汇总了Java中org.ofbiz.base.util.cache.UtilCache.remove方法的典型用法代码示例。如果您正苦于以下问题:Java UtilCache.remove方法的具体用法?Java UtilCache.remove怎么用?Java UtilCache.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ofbiz.base.util.cache.UtilCache
的用法示例。
在下文中一共展示了UtilCache.remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: remove
import org.ofbiz.base.util.cache.UtilCache; //导入方法依赖的package包/类
public GenericValue remove(GenericPK pk) {
UtilCache<GenericPK, GenericValue> entityCache = getCache(pk.getEntityName());
if (Debug.verboseOn()) Debug.logVerbose("Removing from EntityCache with PK [" + pk + "], will remove from this cache: " + (entityCache == null ? "[No cache found to remove from]" : entityCache.getName()), module);
if (entityCache == null) return null;
GenericValue retVal = entityCache.remove(pk);
ModelEntity model = pk.getModelEntity();
if (model != null) {
Iterator<String> it = model.getViewConvertorsIterator();
while (it.hasNext()) {
String targetEntityName = it.next();
UtilCache.clearCache(getCacheName(targetEntityName));
}
}
if (Debug.verboseOn()) Debug.logVerbose("Removing from EntityCache with PK [" + pk + "], found this in the cache: " + retVal, module);
return retVal;
}
示例2: remove
import org.ofbiz.base.util.cache.UtilCache; //导入方法依赖的package包/类
public GenericWidgetOutput remove(String screenName, WidgetContextCacheKey wcck) {
UtilCache<WidgetContextCacheKey,GenericWidgetOutput> screenCache = getCache(screenName);
if (Debug.verboseOn()) Debug.logVerbose("Removing from ScreenCache with key [" + wcck + "], will remove from this cache: " + (screenCache == null ? "[No cache found to remove from]" : screenCache.getName()), module);
if (screenCache == null) return null;
GenericWidgetOutput retVal = screenCache.remove(wcck);
if (Debug.verboseOn()) Debug.logVerbose("Removing from ScreenCache with key [" + wcck + "], found this in the cache: " + retVal, module);
return retVal;
}
示例3: remove
import org.ofbiz.base.util.cache.UtilCache; //导入方法依赖的package包/类
public void remove(String entityName, EntityCondition condition) {
UtilCache<EntityCondition, ConcurrentMap<K, V>> cache = getCache(entityName);
if (cache == null) return;
cache.remove(condition);
}
示例4: removeElementEvent
import org.ofbiz.base.util.cache.UtilCache; //导入方法依赖的package包/类
/** An HTTP WebEvent handler the specified element from the specified cache
* @param request The HTTP request object for the current JSP or Servlet request.
* @param response The HTTP response object for the current JSP or Servlet request.
* @return return an HTTP WebEvent handler the specified element from the specified cache
*/
public static String removeElementEvent(HttpServletRequest request, HttpServletResponse response) {
String errMsg = "";
Locale locale = UtilHttp.getLocale(request);
Security security = (Security) request.getAttribute("security");
if (!security.hasPermission("UTIL_CACHE_EDIT", request.getSession())) {
errMsg = UtilProperties.getMessage(UtilCacheEvents.err_resource, "utilCacheEvents.permissionEdit", locale) + ".";
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}
String name = request.getParameter("UTIL_CACHE_NAME");
if (name == null) {
errMsg = UtilProperties.getMessage(UtilCacheEvents.err_resource, "utilCacheEvents.noCacheNameSpecified", locale) + ".";
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}
String numString = request.getParameter("UTIL_CACHE_ELEMENT_NUMBER");
if (numString == null) {
errMsg = UtilProperties.getMessage(UtilCacheEvents.err_resource, "utilCacheEvents.noElementNumberSpecified", locale) + ".";
request.setAttribute("_ERROR_MESSAGE_", "");
return "error";
}
int number;
try {
number = Integer.parseInt(numString);
} catch (Exception e) {
return "error";
}
UtilCache<?, ?> utilCache = UtilCache.findCache(name);
if (utilCache != null) {
Object key = null;
Iterator<?> ksIter = utilCache.getCacheLineKeys().iterator();
int curNum = 0;
while (ksIter.hasNext()) {
if (number == curNum) {
key = ksIter.next();
break;
} else {
ksIter.next();
}
curNum++;
}
if (key != null) {
utilCache.remove(key);
errMsg = UtilProperties.getMessage(UtilCacheEvents.err_resource, "utilCache.removeElementWithKey", UtilMisc.toMap("key", key.toString()), locale) + ".";
request.setAttribute("_EVENT_MESSAGE_", errMsg);
} else {
errMsg = UtilProperties.getMessage(UtilCacheEvents.err_resource, "utilCache.couldNotRemoveElementNumber", UtilMisc.toMap("name", name, "numString", numString), locale) + ".";
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}
} else {
errMsg = UtilProperties.getMessage(UtilCacheEvents.err_resource, "utilCache.couldNotRemoveElement", UtilMisc.toMap("name", name), locale) + ".";
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}
return "success";
}