diff --git a/src/rocksdb_options.rs b/src/rocksdb_options.rs index 1a1dc06..f45a4e3 100644 --- a/src/rocksdb_options.rs +++ b/src/rocksdb_options.rs @@ -65,6 +65,15 @@ impl BlockBasedOptions { size); } } + + pub fn set_lru_cache(&mut self, size: size_t) { + let cache = rocksdb_ffi::new_cache(size); + unsafe { + // because cache is wrapped in shared_ptr, so we don't need to call + // rocksdb_cache_destroy explicitly. + rocksdb_ffi::rocksdb_block_based_options_set_block_cache(self.inner, cache); + } + } } impl Default for BlockBasedOptions {