磁盘的K/V存储 JDBM2

码农软件 · 软件分类 · 缓存系统 · 2019-08-30 16:26:28

软件介绍

JDBM2 提供了 HashMap 和 TreeMap 的磁盘存储功能,简单易用,用于持久化数据。特别适合用于嵌入到其他应用程序中。示例代码:

/** create (or open existing) database */
String fileName = "helloWorld";
RecordManager recMan = RecordManagerFactory.createRecordManager(fileName);

/** Creates TreeMap which stores data in database.  
 *  Constructor method takes recordName (something like SQL table name)*/
String recordName = "firstTreeMap";
PrimaryTreeMap treeMap = recMan.treeMap(recordName); 

/** add some stuff to map*/
treeMap.put(1, "One");
treeMap.put(2, "Two");
treeMap.put(3, "Three");

System.out.println(treeMap.keySet());
// > [1, 2, 3]

/** Map changes are not persisted yet, commit them (save to disk) */
recMan.commit();

System.out.println(treeMap.keySet());
// > [1, 2, 3]

/** Delete one record. Changes are not commited yet, but are visible. */
treeMap.remove(2);

System.out.println(treeMap.keySet());
// > [1, 3]

/** Did not like change. Roolback to last commit (undo record remove). */
recMan.rollback();

/** Key 2 was recovered */
System.out.println(treeMap.keySet());
// > [1, 2, 3]

/** close record manager */
recMan.close();

本文地址:https://www.codercto.com/soft/d/13510.html

Rework

Rework

Jason Fried、David Heinemeier Hansson / Crown Business / 2010-3-9 / USD 22.00

"Jason Fried and David Hansson follow their own advice in REWORK, laying bare the surprising philosophies at the core of 37signals' success and inspiring us to put them into practice. There's no jarg......一起来看看 《Rework》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具