mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
[JAVA] Add java binding for Options.block_cache.
Summary: Add java bindings for Options.block_cache and allow DbBenchmark to set cache_size. Test Plan: make rocksdbjava make jtest make jdb_Bench Reviewers: haobo, sdong, ankgup87 Reviewed By: ankgup87 CC: leveldb, dhruba Differential Revision: https://reviews.facebook.net/D17481
This commit is contained in:
@@ -13,6 +13,7 @@ package org.rocksdb;
|
||||
* become out-of-scope to release the allocated memory in c++.
|
||||
*/
|
||||
public class Options {
|
||||
static final long DEFAULT_CACHE_SIZE = 8 << 20;
|
||||
/**
|
||||
* Construct options for opening a RocksDB.
|
||||
*
|
||||
@@ -21,6 +22,7 @@ public class Options {
|
||||
*/
|
||||
public Options() {
|
||||
nativeHandle_ = 0;
|
||||
cacheSize_ = DEFAULT_CACHE_SIZE;
|
||||
newOptions();
|
||||
}
|
||||
|
||||
@@ -198,6 +200,24 @@ public class Options {
|
||||
return maxBackgroundCompactions(nativeHandle_);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the amount of cache in bytes that will be used by RocksDB.
|
||||
* If cacheSize is non-positive, then cache will not be used.
|
||||
*
|
||||
* DEFAULT: 8M
|
||||
*/
|
||||
public Options setCacheSize(long cacheSize) {
|
||||
cacheSize_ = cacheSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the amount of cache in bytes that will be used by RocksDB.
|
||||
*/
|
||||
public long cacheSize() {
|
||||
return cacheSize_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Release the memory allocated for the current instance
|
||||
* in the c++ side.
|
||||
@@ -231,4 +251,5 @@ public class Options {
|
||||
private native int maxBackgroundCompactions(long handle);
|
||||
|
||||
long nativeHandle_;
|
||||
long cacheSize_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user