// MUST NOT return null
try {
InputStream in = cache.load(originalUrl, false, stable);
- Instance.trace("Cache " + (in != null ? "hit" : "miss") + ": "
- + url);
+ Instance.getTraceHandler().trace(
+ "Cache " + (in != null ? "hit" : "miss") + ": " + url);
if (in == null) {
try {
ImageIO.write(ImageUtils.fromStream(in), Instance.getConfig()
.getString(Config.IMAGE_FORMAT_CONTENT).toLowerCase(),
target);
+ } catch (IOException e) {
+ throw new IOException("Cannot write image " + url, e);
} finally {
in.close();
}
return cache.load(uniqueID, true, true);
}
+ /**
+ * Remove the given resource from the cache.
+ *
+ * @param uniqueID
+ * a unique ID used to locate the cached resource
+ *
+ * @return TRUE if it was removed
+ */
+ public boolean removeFromCache(String uniqueID) {
+ return cache.remove(uniqueID);
+ }
+
/**
* Clean the cache (delete the cached items).
*