From 1f15b9eae9ca9453452f16b1cc76e05b3bcfb696 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 12 Oct 2013 21:57:05 +0200 Subject: [PATCH] Store album relationships. --- .../java/net/pterodactylus/sone/database/memory/MemoryDatabase.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(); } -- 2.7.4