/** * Determine if an object should be in the memory buffer. * @param currentTime * @param info * @return */ private boolean shouldPlaceInMemoryBuffer(PhysicalInfo info) { if (info.evicting || info.inode != EMPTY_ADDRESS) { return false; } if (info.block == EMPTY_ADDRESS) { return true; } PhysicalInfo lowest = memoryBufferEntries.firstEntry(false); CacheKey key = info.getKey(); return (blocksInuse.getTotalBits() - blocksInuse.getBitsSet()) > (cleaningThreshold + info.memoryBlockCount) || (lowest != null && lowest.block != EMPTY_ADDRESS && lowest.getKey().getOrderingValue() < key.getOrderingValue()); }
/** * Determine if an object should be in the memory buffer. * @param currentTime * @param info * @return */ private boolean shouldPlaceInMemoryBuffer(PhysicalInfo info) { if (info.evicting || info.inode != EMPTY_ADDRESS) { return false; } if (info.block == EMPTY_ADDRESS) { return true; } PhysicalInfo lowest = memoryBufferEntries.firstEntry(false); CacheKey key = info.getKey(); return (blocksInuse.getTotalBits() - blocksInuse.getBitsSet()) > (cleaningThreshold + info.memoryBlockCount) || (lowest != null && lowest.block != EMPTY_ADDRESS && lowest.getKey().getOrderingValue() < key.getOrderingValue()); }
/** * Determine if an object should be in the memory buffer. * Adds are indicated by a current time of 0. * @param currentTime * @param info * @return */ private boolean shouldPlaceInMemoryBuffer(long currentTime, PhysicalInfo info) { PhysicalInfo lowest = memoryBufferEntries.firstEntry(false); CacheKey key = info.getKey(); return (blocksInuse.getTotalBits() - blocksInuse.getBitsSet()) > (cleaningThreshold + info.memoryBlockCount) || (lowest != null && lowest.block != EMPTY_ADDRESS && lowest.getKey().getOrderingValue() < (currentTime>0?memoryBufferEntries.computeNextOrderingValue(currentTime, key.getLastAccess(), key.getOrderingValue()):key.getOrderingValue())); }