X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FCacheLibrary.java;h=a550740bafa7a9105d271ef9dd7df53515651d6e;hb=cf45a4c44b472d0e1bbbcbc9891020366e99364c;hp=977331f33ecf0783084f730414b0862dd1de86c1;hpb=9e2fad3600cd08eca73d45cb5c991d98095842aa;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/library/CacheLibrary.java b/src/be/nikiroo/fanfix/library/CacheLibrary.java index 977331f..a550740 100644 --- a/src/be/nikiroo/fanfix/library/CacheLibrary.java +++ b/src/be/nikiroo/fanfix/library/CacheLibrary.java @@ -112,14 +112,36 @@ public class CacheLibrary extends BasicLibrary { @Override public Image getSourceCover(String source) { - // no cache for the source cover + Image custom = getCustomSourceCover(source); + if (custom != null) { + return custom; + } + + Image cached = cacheLib.getSourceCover(source); + if (cached != null) { + return cached; + } + return lib.getSourceCover(source); } + @Override + public Image getCustomSourceCover(String source) { + Image custom = cacheLib.getCustomSourceCover(source); + if (custom == null) { + custom = lib.getCustomSourceCover(source); + if (custom != null) { + cacheLib.setSourceCover(source, custom); + } + } + + return custom; + } + @Override public void setSourceCover(String source, String luid) { lib.setSourceCover(source, luid); - cacheLib.setSourceCover(source, getSourceCover(source)); + cacheLib.setSourceCover(source, getCover(luid)); } @Override @@ -232,6 +254,9 @@ public class CacheLibrary extends BasicLibrary { /** * Clear the {@link Story} from the cache. + *

+ * The next time we try to retrieve the {@link Story}, it may be required to + * cache it again. * * @param luid * the story to clear