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";
}

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" ; }
an http webevent handler that clears the named cache
