Skip to content

Commit ed46ee6

Browse files
committed
Micro optimization
1 parent f1f45a9 commit ed46ee6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/src/main/java/de/bluecolored/bluemap/core/storage/sql/SQLMapStorage.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,17 @@ public SQLMapStorage(String mapId, CommandSet sql, Compression compression) {
5353

5454
@Override
5555
public ItemStorage item(Key key, Compression compression) {
56+
ItemStorage item = itemStorages.getIfPresent(key);
57+
if (item != null) return item;
58+
5659
return itemStorages.get(key, k -> new SQLItemStorage(sql, mapId, key, compression));
5760
}
5861

5962
@Override
6063
public GridStorage grid(Key key, Compression compression) {
64+
GridStorage grid = gridStorages.getIfPresent(key);
65+
if (grid != null) return grid;
66+
6167
return gridStorages.get(key, k -> new SQLGridStorage(sql, mapId, key, compression));
6268
}
6369

0 commit comments

Comments
 (0)