Skip to content

Commit

Permalink
Store block in cache when uploading it
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignas committed Dec 17, 2023
1 parent 19967d9 commit eeafeb7
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ public void putBlock(
.stream(new ByteArrayInputStream(buffer, 0, length), length, -1)
.contentType("application/octet-stream")
.build());
byte[] truncatedBuffer = new byte[length];
System.arraycopy(buffer, 0, truncatedBuffer, 0, length);
blockCache.put(getBlockKey(repositoryId, blockNumber, fileName), truncatedBuffer);
} catch (MinioException | InvalidKeyException | NoSuchAlgorithmException e) {
throw new IOException(e);
}
Expand Down

0 comments on commit eeafeb7

Please sign in to comment.