It seems there's not such interface..
Do I have to iterate all keys to get the count?
What is the design purpose of that? Or what is the limitation of implement this feature?
It seems there's not such interface..
Do I have to iterate all keys to get the count?
What is the design purpose of that? Or what is the limitation of implement this feature?
Probably when LevelDB was built, this API was not required for the original authors. Sadly LevelDB does not have an increment API which you can use to record counting. What you can do right now is read and write a key in Leveldb, but this is not thread safe.
May be you could have a look at Redis, if it is better suited for your use case.