class SegmentedCacheFunction implements CacheFunction {

    int compareSegmentedKeys(final Bytes cacheKey, final Bytes storeKey) {
        final long storeSegmentId = segmentId(storeKey);
        final long cacheSegmentId = ByteBuffer.wrap(cacheKey.get()).getLong();

        final int segmentCompare = Long.compare(cacheSegmentId, storeSegmentId);
        if (segmentCompare == 0) {
            final byte[] cacheKeyBytes = cacheKey.get();
            final byte[] storeKeyBytes = storeKey.get();
            return Bytes.BYTES_LEXICO_COMPARATOR.compare(
                cacheKeyBytes, SEGMENT_ID_BYTES, cacheKeyBytes.length - SEGMENT_ID_BYTES,
                storeKeyBytes, 0, storeKeyBytes.length
            );
        } else {
            return segmentCompare;
        }
    }

      SegmentedCacheFunction(final KeySchema keySchema, final long segmentInterval);

}