X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FBasicLibrary.java;h=9e7d4644494e5b51d871091868c3c1e47d882f53;hb=e272f05fd49f01e9fb6bd71c7b74a32839bbcc38;hp=df283db258304a475714156de90abec37f344945;hpb=1b9a09a2d3ddd4558c9f440392e50504421ddb2e;p=nikiroo-utils.git diff --git a/src/be/nikiroo/fanfix/library/BasicLibrary.java b/src/be/nikiroo/fanfix/library/BasicLibrary.java index df283db..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. @@ -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); } /**