MMFMapTable extends AbstractSortedMapTable { public IMapEntry appendNew(byte[] key, byte[] value, long timeToLive) throws IOException { return this.appendNew(key, Arrays.hashCode(key), value, timeToLive, System.currentTimeMillis(), false, false); } MMFMapTable(String dir, int level, long createdTime, int expectedInsertions, int mergeWays);  MMFMapTable(String dir, short shard, int level, long createdTime, int expectedInsertions, int mergeWays);  MMFMapTable(String dir, String fileName); void reMap(); IMapEntry appendNew(byte[] key, byte[] value, long timeToLive); @Override IMapEntry appendNew(byte[] key, int keyHash, byte[] value, long timeToLive, long createdTime, boolean markDelete, boolean compressed); @Override IMapEntry getMapEntry(int index); @Override void close();  }
@Test public void testAppendAndGet() throws IOException, ClassNotFoundException { long createdTime = System.nanoTime(); mapTable = new MMFMapTable(testDir, 1, createdTime, 1000, 4); assertTrue(mapTable.getLevel() == 1); assertTrue(mapTable.getCreatedTime() == createdTime); assertTrue(mapTable.getAppendedSize() == 0); assertTrue(mapTable.isEmpty()); mapTable.appendNew("key".getBytes(), "value".getBytes(), 500); assertTrue(mapTable.getLevel() == 1); assertTrue(mapTable.getCreatedTime() == createdTime); assertTrue(mapTable.getAppendedSize() == 1); assertFalse(mapTable.isEmpty()); GetResult result = mapTable.get("key".getBytes()); assertTrue(result.isFound()); assertTrue(!result.isDeleted()); assertTrue(!result.isExpired()); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } result = mapTable.get("key".getBytes()); assertTrue(result.isFound()); assertTrue(!result.isDeleted()); assertTrue(result.isExpired()); result = mapTable.get("key1".getBytes()); assertFalse(result.isFound()); assertFalse(mapTable.isUsable()); }