<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          JDBM2磁盤(pán)的K/V存儲(chǔ)

          聯(lián)合創(chuàng)作 · 2023-09-29 06:26

          JDBM2 提供了 HashMap 和 TreeMap 的磁盤(pán)存儲(chǔ)功能,簡(jiǎn)單易用,用于持久化數(shù)據(jù)。特別適合用于嵌入到其他應(yīng)用程序中。示例代碼:

          /** 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();
          
          瀏覽 25
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  色情小电影免费网站观看网址在线播 | 亚洲五月天婷婷在线 | 天天干天天操天天拍 | 色婷婷精品在线播放 | 免费啪啪网 |