From 02ec8154e5598da317eb9dd7671c1be9733b8753 Mon Sep 17 00:00:00 2001 From: Jan Doms Date: Fri, 3 Jun 2016 15:04:51 +0200 Subject: [PATCH] allow updating block cache capacity from C (#1149) --- db/c.cc | 4 ++++ include/rocksdb/c.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/db/c.cc b/db/c.cc index 3c3178ec2..373ccb7ac 100644 --- a/db/c.cc +++ b/db/c.cc @@ -2173,6 +2173,10 @@ void rocksdb_cache_destroy(rocksdb_cache_t* cache) { delete cache; } +void rocksdb_cache_set_capacity(rocksdb_cache_t* cache, size_t capacity) { + cache->rep->SetCapacity(capacity); +} + rocksdb_env_t* rocksdb_create_default_env() { rocksdb_env_t* result = new rocksdb_env_t; result->rep = Env::Default(); diff --git a/include/rocksdb/c.h b/include/rocksdb/c.h index 0e7ae0a8c..18d44c058 100644 --- a/include/rocksdb/c.h +++ b/include/rocksdb/c.h @@ -847,6 +847,8 @@ extern ROCKSDB_LIBRARY_API void rocksdb_flushoptions_set_wait( extern ROCKSDB_LIBRARY_API rocksdb_cache_t* rocksdb_cache_create_lru( size_t capacity); extern ROCKSDB_LIBRARY_API void rocksdb_cache_destroy(rocksdb_cache_t* cache); +extern ROCKSDB_LIBRARY_API void rocksdb_cache_set_capacity( + rocksdb_cache_t* cache, size_t capacity); /* Env */