我建议你看看京都内阁。我正在围绕它编写一些 Scala 包装器,允许您将它作为一个普通的老式香草 Scala 映射来访问。我自己还没有做过基准测试,但是根据那里的基准测试,它比 Berkeley DB 快。(但是,现在说还为时过早,因为没有关于 Java 集成开销的文档。)
在此处查看JavaDoc API。我一直在 REPL 上玩弄它,它工作得很好。
以下是来自 REPL 的一些证明,证明它有效:
$ scala -Djava.library.path=/usr/local/lib
Welcome to Scala version 2.8.0.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_15).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :cp /Users/wilfred/.m2/repository/com/fallabs/kyotocabinet/1.15/kyotocabinet-1.15.jar
Added '/Users/wilfred/.m2/repository/com/fallabs/kyotocabinet/1.15/kyotocabinet-1.15.jar'. Your new classpath is:
.:/Users/wilfred/.m2/repository/com/fallabs/kyotocabinet/1.15/kyotocabinet-1.15.jar
scala> import kyotocabinet._
import kyotocabinet._
scala> val db = new DB()
db: kyotocabinet.DB = (null): -1: -1
scala> db.open("casket.kch", DB.OWRITER | DB.OCREATE)
res0: Boolean = true
scala> db.set("foo", "bar")
res1: Boolean = true
scala> db.get("foo")
res2: java.lang.String = bar