コード例 #1
0
ファイル: LRUCacheTest.java プロジェクト: fmedio/koa
 @Test
 public void testOldBlocksAreEvicted() throws Exception {
   assertTrue(isZero(storage.bytes()));
   cache.obtainBlock(storage, new BlockId(0)).put(0, (byte) 1);
   cache.obtainBlock(storage, new BlockId(1)).put(0, (byte) 1);
   assertTrue(isZero(storage.bytes()));
   cache.obtainBlock(storage, new BlockId(2)).put(0, (byte) 1);
   assertFalse(isZero(storage.bytes()));
 }
コード例 #2
0
ファイル: LRUCacheTest.java プロジェクト: fmedio/koa
 @Test
 public void testBasicOperation() throws Exception {
   final Block block = cache.obtainBlock(storage, new BlockId(0));
   assertTrue(isZero(storage.bytes()));
   block.put(0, (byte) 1);
   assertTrue(isZero(storage.bytes()));
   cache.flush();
   assertFalse(isZero(storage.bytes()));
 }