X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FBasicLibrary.java;h=9e7d4644494e5b51d871091868c3c1e47d882f53;hb=e272f05fd49f01e9fb6bd71c7b74a32839bbcc38;hp=42c6c9d843063dc64956dc90e285ac476e068b1d;hpb=fd1d31c20100442f3c2480b8177a2df761613a15;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/library/BasicLibrary.java b/src/be/nikiroo/fanfix/library/BasicLibrary.java index 42c6c9d..9e7d464 100644 --- a/src/be/nikiroo/fanfix/library/BasicLibrary.java +++ b/src/be/nikiroo/fanfix/library/BasicLibrary.java @@ -135,7 +135,19 @@ abstract public class BasicLibrary { * Invalidate the {@link Story} cache (when the content should be re-read * because it was changed). */ - protected abstract void clearCache(); + protected void invalidateInfo() { + invalidateInfo(null); + } + + /** + * Invalidate the {@link Story} cache (when the content should be re-read + * because it was changed). + * + * @param luid + * the luid of the {@link Story} to clear from the cache, or NULL + * for all stories + */ + protected abstract void invalidateInfo(String luid); /** * Return the next LUID that can be used. @@ -445,7 +457,7 @@ abstract public class BasicLibrary { pg.addProgress(pgOut, 1); } - BasicOutput out = BasicOutput.getOutput(type, false); + BasicOutput out = BasicOutput.getOutput(type, false, false); if (out == null) { throw new IOException("Output type not supported: " + type); } @@ -505,13 +517,13 @@ abstract public class BasicLibrary { meta.setLuid(luid); } - if (getInfo(luid) != null) { + if (luid != null && getInfo(luid) != null) { delete(luid); } doSave(story, pg); - clearCache(); + invalidateInfo(luid); return story; } @@ -527,7 +539,7 @@ abstract public class BasicLibrary { */ public synchronized void delete(String luid) throws IOException { doDelete(luid); - clearCache(); + invalidateInfo(luid); } /**