try {
cacheLib.imprt(lib, luid, pgImport);
pgImport.done();
- Story story = cacheLib.getStory(luid, pgGet);
- metas.remove(story.getMeta());
- metas.add(story.getMeta());
+ clearCache();
} catch (IOException e) {
- Instance.syserr(e);
+ Instance.getTraceHandler().error(e);
}
pgImport.done();
@Override
public BufferedImage getCover(final String luid) {
- // Retrieve it from the cache if possible:
if (isCached(luid)) {
return cacheLib.getCover(luid);
}
+ // We could update the cache here, but it's not easy
return lib.getCover(luid);
}
+ @Override
+ public BufferedImage getSourceCover(String source) {
+ // no cache for the source cover
+ return lib.getSourceCover(source);
+ }
+
+ @Override
+ public void setSourceCover(String source, String luid) {
+ lib.setSourceCover(source, luid);
+ cacheLib.setSourceCover(source, getSourceCover(source));
+ }
+
@Override
protected void clearCache() {
metas = null;
@Override
public synchronized void delete(String luid) throws IOException {
- cacheLib.delete(luid);
+ if (isCached(luid)) {
+ cacheLib.delete(luid);
+ }
lib.delete(luid);
clearCache();
}
- @Override
- public void setSourceCover(String source, String luid) {
- cacheLib.setSourceCover(source, luid);
- lib.setSourceCover(source, luid);
- }
-
@Override
public synchronized void changeSource(String luid, String newSource,
Progress pg) throws IOException {
pg.addProgress(pgCache, 1);
pg.addProgress(pgOrig, 1);
- cacheLib.changeSource(luid, newSource, pgCache);
+ if (isCached(luid)) {
+ cacheLib.changeSource(luid, newSource, pgCache);
+ }
pgCache.done();
lib.changeSource(luid, newSource, pgOrig);
pgOrig.done();
* in case of I/O error
*/
public void clearFromCache(String luid) throws IOException {
- cacheLib.delete(luid);
- clearCache();
+ if (isCached(luid)) {
+ cacheLib.delete(luid);
+ clearCache();
+ }
}
// All the following methods are only used by Save and Delete in