开发者

cached data base

开发者 https://www.devze.com 2022-12-25 05:52 出处:网络
in my project i need a tow tables each of it has about 2000 row , i want my application to be speed so my db should load into memory (cached) when the app start and b开发者_Python百科efore it close th

in my project i need a tow tables each of it has about 2000 row , i want my application to be speed so my db should load into memory (cached) when the app start and b开发者_Python百科efore it close the db have to be saved on the disk . i am using java and i want to use sql


For Java, take a look at H2. It has in-memory databases, is written in Java and should provide the performance you need. Derby or HSQLDB are other Java alternatives.


Take a look at SQLite and SqliteJDBC

Be aware though, that 2000rows is by no means large for a DB!


If the database that you need in memory is mostly read only I would keep a cache in memory but whenever there is a write I would propagate that change directly to the database. This way if the application breaks down you have the current state already in the database.

This should be very simple to write using a Map (or a series of Maps if you need multiple keys to access the data).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号