- protected void updateInfo(MetaData meta) {
- if (meta != null) {
- for (int i = 0; i < metas.size(); i++) {
- if (metas.get(i).getLuid().equals(meta.getLuid())) {
- metas.set(i, meta);
+ public void setAuthorCover(String author, String luid) throws IOException {
+ lib.setAuthorCover(author, luid);
+ cacheLib.setAuthorCover(author, getCover(luid));
+ }
+
+ /**
+ * Invalidate the {@link Story} cache (when the content has changed, but we
+ * already have it) with the new given meta.
+ * <p>
+ * <b>Make sure to always use {@link MetaData} from the cached library in
+ * priority, here.</b>
+ *
+ * @param meta
+ * the {@link Story} to clear from the cache
+ *
+ * @throws IOException
+ * in case of IOException
+ */
+ @Override
+ @Deprecated
+ protected void updateInfo(MetaData meta) throws IOException {
+ throw new IOException(
+ "This method is not supported in a CacheLibrary, please use updateMetaCache");
+ }
+
+ // relplace the meta in Metas by Meta, add it if needed
+ // return TRUE = added
+ private boolean updateMetaCache(List<MetaData> metas, MetaData meta) {
+ if (meta != null && metas != null) {
+ synchronized (metasLock) {
+ boolean changed = false;
+ for (int i = 0; i < metas.size(); i++) {
+ if (metas.get(i).getLuid().equals(meta.getLuid())) {
+ metas.set(i, meta);
+ changed = true;
+ }
+ }
+
+ if (!changed) {
+ metas.add(meta);
+ return true;