本文整理汇总了Java中org.ofbiz.base.util.cache.UtilCache.findCache方法的典型用法代码示例。如果您正苦于以下问题:Java UtilCache.findCache方法的具体用法?Java UtilCache.findCache怎么用?Java UtilCache.findCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ofbiz.base.util.cache.UtilCache
的用法示例。
在下文中一共展示了UtilCache.findCache方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clearContentAssocViewCache
import org.ofbiz.base.util.cache.UtilCache; //导入方法依赖的package包/类
public static Map<String, Object> clearContentAssocViewCache(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{
Map<String, Object> results = FastMap.newInstance();
UtilCache<?, ?> utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewFrom");
if (utilCache != null) {
utilCache.clear();
}
utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewTo");
if (utilCache != null) {
utilCache.clear();
}
return results;
}
示例2: clearContentAssocDataResourceViewCache
import org.ofbiz.base.util.cache.UtilCache; //导入方法依赖的package包/类
public static Map<String, Object> clearContentAssocDataResourceViewCache(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{
Map<String, Object> results = FastMap.newInstance();
UtilCache<?, ?> utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewDataResourceFrom");
if (utilCache != null) {
utilCache.clear();
}
utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewDataResourceTo");
if (utilCache != null) {
utilCache.clear();
}
return results;
}
示例3: clearEvent
import org.ofbiz.base.util.cache.UtilCache; //导入方法依赖的package包/类
/** An HTTP WebEvent handler that clears the named 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 that clears the named cache
*/
public static String clearEvent(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, "utilCache.couldNotClearCache", locale) + ".";
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}
UtilCache<?, ?> utilCache = UtilCache.findCache(name);
if (utilCache != null) {
utilCache.clear();
errMsg = UtilProperties.getMessage(UtilCacheEvents.err_resource, "utilCache.clearCache", UtilMisc.toMap("name", name), locale) + ".";
request.setAttribute("_EVENT_MESSAGE_", errMsg);
} else {
errMsg = UtilProperties.getMessage(UtilCacheEvents.err_resource, "utilCache.couldNotClearCacheNotFoundName", UtilMisc.toMap("name", name), locale) + ".";
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}
return "success";
}
示例4: getCache
import org.ofbiz.base.util.cache.UtilCache; //导入方法依赖的package包/类
protected UtilCache<K, V> getCache(String entityName) {
return UtilCache.findCache(getCacheName(entityName));
}
示例5: 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";
}
示例6: getCache
import org.ofbiz.base.util.cache.UtilCache; //导入方法依赖的package包/类
protected <K,V> UtilCache<K,V> getCache(String widgetName) {
return UtilCache.findCache(getCacheName(widgetName));
}