move isCache/cleanCache to BasicLibrary, improve filter()
[fanfix.git] / src / be / nikiroo / fanfix / library / CacheLibrary.java
index cccfedba0cfd29ec755034b9197f7a7495dd0b38..9c83e62f76ceb388125cbc73d8769b296513b211 100644 (file)
@@ -3,6 +3,7 @@ package be.nikiroo.fanfix.library;
 import java.io.File;
 import java.io.IOException;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.List;
 
 import be.nikiroo.fanfix.Instance;
@@ -63,7 +64,7 @@ public class CacheLibrary extends BasicLibrary {
                }
 
                pg.done();
-               return metas;
+               return new ArrayList<MetaData>(metas);
        }
 
        @Override
@@ -316,15 +317,7 @@ public class CacheLibrary extends BasicLibrary {
                invalidateInfo(luid);
        }
 
-       /**
-        * Check if the {@link Story} denoted by this Library UID is present in the
-        * cache.
-        * 
-        * @param luid
-        *            the Library UID
-        * 
-        * @return TRUE if it is
-        */
+       @Override
        public boolean isCached(String luid) {
                try {
                        return cacheLib.getInfo(luid) != null;
@@ -333,18 +326,7 @@ public class CacheLibrary extends BasicLibrary {
                }
        }
 
-       /**
-        * Clear the {@link Story} from the cache.
-        * <p>
-        * The next time we try to retrieve the {@link Story}, it may be required to
-        * cache it again.
-        * 
-        * @param luid
-        *            the story to clear
-        * 
-        * @throws IOException
-        *             in case of I/O error
-        */
+       @Override
        public void clearFromCache(String luid) throws IOException {
                if (isCached(luid)) {
                        cacheLib.delete(luid);