From 3828c808ecfff13b78c1b2c077f74d6e81799ec0 Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sun, 24 Mar 2019 20:18:07 +0100 Subject: [PATCH] lib: cache not refreshed on changeSTA --- src/be/nikiroo/fanfix/library/BasicLibrary.java | 2 ++ src/be/nikiroo/fanfix/library/CacheLibrary.java | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) 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); } /** -- 2.27.0