From: Niki Roo Date: Sun, 24 Mar 2019 19:18:07 +0000 (+0100) Subject: lib: cache not refreshed on changeSTA X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=3828c808ecfff13b78c1b2c077f74d6e81799ec0;p=fanfix-jexer.git lib: cache not refreshed on changeSTA --- diff --git a/src/be/nikiroo/fanfix/library/BasicLibrary.java b/src/be/nikiroo/fanfix/library/BasicLibrary.java index 4abaefa..7f7a09d 100644 --- a/src/be/nikiroo/fanfix/library/BasicLibrary.java +++ b/src/be/nikiroo/fanfix/library/BasicLibrary.java @@ -943,6 +943,8 @@ abstract public class BasicLibrary { meta.setTitle(newTitle); meta.setAuthor(newAuthor); saveMeta(meta, pg); + + invalidateInfo(luid); } /** diff --git a/src/be/nikiroo/fanfix/library/CacheLibrary.java b/src/be/nikiroo/fanfix/library/CacheLibrary.java index bafaf94..8f6e9c2 100644 --- a/src/be/nikiroo/fanfix/library/CacheLibrary.java +++ b/src/be/nikiroo/fanfix/library/CacheLibrary.java @@ -65,6 +65,16 @@ public class CacheLibrary extends BasicLibrary { return metas; } + @Override + public synchronized MetaData getInfo(String luid) { + MetaData info = cacheLib.getInfo(luid); + if (info == null) { + info = lib.getInfo(luid); + } + + return info; + } + @Override public synchronized Story getStory(String luid, MetaData meta, Progress pg) { if (pg == null) { @@ -260,10 +270,7 @@ public class CacheLibrary extends BasicLibrary { } lib.delete(luid); - MetaData meta = getInfo(luid); - if (meta != null) { - metas.remove(meta); - } + invalidateInfo(luid); } @Override @@ -296,6 +303,8 @@ public class CacheLibrary extends BasicLibrary { meta.setTitle(newTitle); meta.setAuthor(newAuthor); pg.done(); + + invalidateInfo(luid); } /**