@Test public void testDataIsCachable() { AbstractCacheWrapper uut = new AbstractCacheWrapper(entries, storageAll, 20000, predicate -> true); assertTrue(uut.dataIsCachable(c0)); assertTrue(uut.dataIsCachable(c1)); assertTrue(uut.dataIsCachable(c2)); assertTrue(uut.dataIsCachable(c3)); entries.clear(); uut = new AbstractCacheWrapper(entries, storageAll, 20000, predicate -> false); assertFalse(uut.dataIsCachable(c0)); assertFalse(uut.dataIsCachable(c1)); assertFalse(uut.dataIsCachable(c2)); assertFalse(uut.dataIsCachable(c3)); entries.clear(); uut = new AbstractCacheWrapper(entries, storageAll, 20000, predicate -> predicate.getId() == c1.getId() || predicate.getId() == c3.getId()); assertFalse(uut.dataIsCachable(c0)); assertTrue(uut.dataIsCachable(c1)); assertFalse(uut.dataIsCachable(c2)); assertTrue(uut.dataIsCachable(c3)); }
@Override public boolean dataIsCachable(T data) { return cachingRule.test(data); }
AbstractCache implements IDataCache<T> { @Override public boolean dataIsCachable(T data) { return cachingRule.test(data); } }
AbstractCache implements IDataCache<T> { @Override public boolean dataIsCachable(T data) { return cachingRule.test(data); } AbstractCache(S entries, IDataStorage<T> cachedStorage, long maxCacheSize,
      Predicate<T> cachingRule); }
AbstractCache implements IDataCache<T> { @Override public boolean dataIsCachable(T data) { return cachingRule.test(data); } AbstractCache(S entries, IDataStorage<T> cachedStorage, long maxCacheSize,
      Predicate<T> cachingRule); @Override long getMaxCacheSize(); @Override boolean setMaxCacheSize(long maxCacheSize); @Override long getCurrentCacheSize(); @Override long getFreeSpace(); @Override boolean hasStorageFor(long size); @Override void cacheData(T data); @Override void uncacheData(T data); @Override boolean dataIsCachable(T data); @Override boolean dataIsInCache(long id); @Override void clearCache(); @Override boolean dataExists(long id); @Override T loadData(long id); @Override boolean saveData(T data); @Override boolean dataIsStorable(T data); @Override boolean deleteData(T data); }
AbstractCache implements IDataCache<T> { @Override public boolean dataIsCachable(T data) { return cachingRule.test(data); } AbstractCache(S entries, IDataStorage<T> cachedStorage, long maxCacheSize,
      Predicate<T> cachingRule); @Override long getMaxCacheSize(); @Override boolean setMaxCacheSize(long maxCacheSize); @Override long getCurrentCacheSize(); @Override long getFreeSpace(); @Override boolean hasStorageFor(long size); @Override void cacheData(T data); @Override void uncacheData(T data); @Override boolean dataIsCachable(T data); @Override boolean dataIsInCache(long id); @Override void clearCache(); @Override boolean dataExists(long id); @Override T loadData(long id); @Override boolean saveData(T data); @Override boolean dataIsStorable(T data); @Override boolean deleteData(T data);  }