Skip to content

Commit

Permalink
Simplify cache
Browse files Browse the repository at this point in the history
  • Loading branch information
RetGal committed Dec 14, 2024
1 parent f2d6ead commit 05fa3e9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/java/mpo/dayon/common/squeeze/RegularTileCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class RegularTileCache implements TileCache {
private final Map<Integer, CaptureTile> tiles;
private final int maxSize;
private final int purgeSize;
private int hits;
private int hits = 0;

public RegularTileCache(int maxSize, int purgeSize) {
this.maxSize = maxSize;
Expand All @@ -26,7 +26,7 @@ public CaptureTile get(Object key) {
if (tile != null) {
++hits;
}
return tile;
return tile != null ? tile : CaptureTile.MISSING;
}
};
Log.info("Regular cache created [MAX:" + maxSize + "][PURGE:" + purgeSize + "]");
Expand All @@ -48,8 +48,7 @@ public void add(CaptureTile tile) {

@Override
public CaptureTile get(int cacheId) {
CaptureTile tile = tiles.get(cacheId);
return tile != null ? tile : CaptureTile.MISSING;
return tiles.get(cacheId);
}

@Override
Expand Down

0 comments on commit 05fa3e9

Please sign in to comment.