From: David ‘Bombe’ Roden Date: Sat, 12 Oct 2013 19:57:05 +0000 (+0200) Subject: Store album relationships. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=1f15b9eae9ca9453452f16b1cc76e05b3bcfb696;p=Sone.git Store album relationships. --- diff --git a/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java b/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java index e7c380a..c778de2 100644 --- a/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java +++ b/src/main/java/net/pterodactylus/sone/database/memory/MemoryDatabase.java @@ -104,7 +104,7 @@ public class MemoryDatabase extends AbstractService implements Database { private final Set knownPostReplies = new HashSet(); private final Map allAlbums = new HashMap(); - + private final ListMultimap albumChildren = ArrayListMultimap.create(); private final ListMultimap albumImages = ArrayListMultimap.create(); private final Map allImages = new HashMap(); @@ -445,6 +445,7 @@ public class MemoryDatabase extends AbstractService implements Database { lock.writeLock().lock(); try { allAlbums.put(album.getId(), album); + albumChildren.put(album.getParent().getId(), album.getId()); } finally { lock.writeLock().unlock(); } @@ -455,6 +456,7 @@ public class MemoryDatabase extends AbstractService implements Database { lock.writeLock().lock(); try { allAlbums.remove(album.getId()); + albumChildren.remove(album.getParent().getId(), album.getId()); } finally { lock.writeLock().unlock(); }