Skip to content

Commit

Permalink
redone last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Uhutown committed Nov 12, 2023
1 parent 9780176 commit 0374994
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ private static long hash(final BlockPos pos) {

@Nullable
public synchronized SignalStatePos find(final BlockPos pos) {
final SignalStatePos cachePos = posCache.get(pos);
if (cachePos != null)
return cachePos;
return (SignalStatePos) internalFind(pos,
(stream, blockPos, offset, file) -> new SignalStatePos(file, offset), "r");
}
Expand All @@ -82,7 +85,7 @@ public synchronized SignalStatePos deleteIndex(final BlockPos pos) {
stream.seek(pointer - 16);
stream.writeLong(0);
stream.writeLong(0);
// TODO posCache.remove(pos);
posCache.remove(pos);
return new SignalStatePos(file, offset);
} catch (final IOException e) {
e.printStackTrace();
Expand Down Expand Up @@ -119,7 +122,7 @@ private synchronized Object internalFind(final BlockPos pos, final InternalFunct
if (currentOffset == hashOffset)
continue nextFile; // Nothing found
} while (!pos.equals(currenPosition));
// TODO posCache.put(pos, new SignalStatePos(counter, offset));
posCache.put(pos, new SignalStatePos(counter, offset));
return function.apply(stream, currenPosition, offset, counter);
}
}
Expand Down

0 comments on commit 0374994

Please sign in to comment.