lib: cache not refreshed on changeSTA
authorNiki Roo <niki@nikiroo.be>
Sun, 24 Mar 2019 19:18:07 +0000 (20:18 +0100)
committerNiki Roo <niki@nikiroo.be>
Sun, 24 Mar 2019 19:18:07 +0000 (20:18 +0100)
src/be/nikiroo/fanfix/library/BasicLibrary.java
src/be/nikiroo/fanfix/library/CacheLibrary.java

index 4abaefa34f099943119bbb9009dd9e42bf42ac35..7f7a09dd528d63ce0322150de77c1c4bf683c4a8 100644 (file)
@@ -943,6 +943,8 @@ abstract public class BasicLibrary {
                meta.setTitle(newTitle);
                meta.setAuthor(newAuthor);
                saveMeta(meta, pg);
+
+               invalidateInfo(luid);
        }
 
        /**
index bafaf9461a65b60a66a760eee66a9c3fa5d275bd..8f6e9c29a24bfd128c64e5fe69e90c98a53ac4e3 100644 (file)
@@ -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);
        }
 
        /**