OffHeapByteBufferStore implements OffHeapStore { public Pointer update(final Pointer pointer, final byte[] payload, final long expiry) { try { return pointer.getOffHeapByteBuffer().update(pointer, payload, expiry); } catch (final BufferOverflowException exception) { return store(payload, expiry); } } OffHeapByteBufferStore(int capacity, int bufferSize);  OffHeapByteBufferStore(int capacity, int bufferSize, int concurrencyLevel); byte[] retrieve(Pointer pointer); byte[] remove(Pointer pointer); Pointer store(byte[] payload, long expiry); Pointer update(final Pointer pointer, final byte[] payload, final long expiry); long dirtyMemory(); long usedMemory(); long freeMemory(); void free(); void free(int bufferIndex);  }
@Test public void update() { int size = 100; final long expiry = System.currentTimeMillis(); byte[] bytes = new byte[size]; random.nextBytes(bytes); Pointer pointer = bufferStore.store(bytes, expiry); byte[] expectedBytes = new byte[size]; random.nextBytes(expectedBytes); pointer = bufferStore.update(pointer, expectedBytes, expiry); byte[] actualBytes = bufferStore.retrieve(pointer); assertArrayEquals(expectedBytes, actualBytes); }