Skip to content

Commit e17ef5c

Browse files
committed
putEntry() method extracted
1 parent 19fd2b3 commit e17ef5c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

portable/comp-android/diacomp/src/main/java/org/bosik/diacomp/android/backend/common/CachedBaseService.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,20 @@ protected void rebuildCache()
8383
memoryCache = index(loadAllFromDb());
8484
}
8585

86-
private void insert(Versioned<T> item)
86+
private synchronized void putEntry(Versioned<T> item)
8787
{
8888
memoryCache.put(item.getId(), clone(item));
89+
}
90+
91+
private void insert(Versioned<T> item)
92+
{
93+
putEntry(item);
8994
insertDb(item);
9095
}
9196

9297
private void update(Versioned<T> item)
9398
{
94-
memoryCache.put(item.getId(), clone(item));
99+
putEntry(item);
95100
updateDb(item);
96101
}
97102

0 commit comments

Comments
 (0)