number = Integer.parseInt(numString);
} catch (Exception e) {
return "error";
}
UtilCache utilCache = UtilCache.findCache(name);
if (utilCache != null) {
Object key = null;
if (utilCache.getMaxSize() > 0) {
try {
key = utilCache.cacheLineTable.getKeyFromMemory(number);
} catch (Exception e) {}
} else {
// no LRU, try looping through the keySet to see if we find the specified index...
Iterator ksIter = utilCache.cacheLineTable.keySet().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);