@Test public void example() { MultiLevelCacheExample.example(); }
@SuppressWarnings("null") public static void example() { final CacheDao cacheDao = null; OffHeapByteBufferStore bufferStore = new OffHeapByteBufferStore(10000, 10); final Cache<String, String> offHeapCache = CacheBuilder.offHeapCache().storage(bufferStore) .cacheLoader((CacheLoader<String, String>) key -> cacheDao.load(key)).evictionListener( (EvictionListener<String, String>) (key, value) -> cacheDao.store(key, value)).build(); Cache<String, String> multiLevelCache = CacheBuilder.heapCache().cacheLoader( (CacheLoader<String, String>) key -> offHeapCache.get(key)).evictionListener( (EvictionListener<String, String>) (key, value) -> offHeapCache.put(key, value)) .capacity(10000).build(); multiLevelCache.put("red", "apple"); }
MultiLevelCacheExample { @SuppressWarnings("null") public static void example() { final CacheDao cacheDao = null; OffHeapByteBufferStore bufferStore = new OffHeapByteBufferStore(10000, 10); final Cache<String, String> offHeapCache = CacheBuilder.offHeapCache().storage(bufferStore) .cacheLoader((CacheLoader<String, String>) key -> cacheDao.load(key)).evictionListener( (EvictionListener<String, String>) (key, value) -> cacheDao.store(key, value)).build(); Cache<String, String> multiLevelCache = CacheBuilder.heapCache().cacheLoader( (CacheLoader<String, String>) key -> offHeapCache.get(key)).evictionListener( (EvictionListener<String, String>) (key, value) -> offHeapCache.put(key, value)) .capacity(10000).build(); multiLevelCache.put("red", "apple"); } }
MultiLevelCacheExample { @SuppressWarnings("null") public static void example() { final CacheDao cacheDao = null; OffHeapByteBufferStore bufferStore = new OffHeapByteBufferStore(10000, 10); final Cache<String, String> offHeapCache = CacheBuilder.offHeapCache().storage(bufferStore) .cacheLoader((CacheLoader<String, String>) key -> cacheDao.load(key)).evictionListener( (EvictionListener<String, String>) (key, value) -> cacheDao.store(key, value)).build(); Cache<String, String> multiLevelCache = CacheBuilder.heapCache().cacheLoader( (CacheLoader<String, String>) key -> offHeapCache.get(key)).evictionListener( (EvictionListener<String, String>) (key, value) -> offHeapCache.put(key, value)) .capacity(10000).build(); multiLevelCache.put("red", "apple"); }  }
MultiLevelCacheExample { @SuppressWarnings("null") public static void example() { final CacheDao cacheDao = null; OffHeapByteBufferStore bufferStore = new OffHeapByteBufferStore(10000, 10); final Cache<String, String> offHeapCache = CacheBuilder.offHeapCache().storage(bufferStore) .cacheLoader((CacheLoader<String, String>) key -> cacheDao.load(key)).evictionListener( (EvictionListener<String, String>) (key, value) -> cacheDao.store(key, value)).build(); Cache<String, String> multiLevelCache = CacheBuilder.heapCache().cacheLoader( (CacheLoader<String, String>) key -> offHeapCache.get(key)).evictionListener( (EvictionListener<String, String>) (key, value) -> offHeapCache.put(key, value)) .capacity(10000).build(); multiLevelCache.put("red", "apple"); }  @SuppressWarnings("null") static void example(); static void main(String[] args); }
MultiLevelCacheExample { @SuppressWarnings("null") public static void example() { final CacheDao cacheDao = null; OffHeapByteBufferStore bufferStore = new OffHeapByteBufferStore(10000, 10); final Cache<String, String> offHeapCache = CacheBuilder.offHeapCache().storage(bufferStore) .cacheLoader((CacheLoader<String, String>) key -> cacheDao.load(key)).evictionListener( (EvictionListener<String, String>) (key, value) -> cacheDao.store(key, value)).build(); Cache<String, String> multiLevelCache = CacheBuilder.heapCache().cacheLoader( (CacheLoader<String, String>) key -> offHeapCache.get(key)).evictionListener( (EvictionListener<String, String>) (key, value) -> offHeapCache.put(key, value)) .capacity(10000).build(); multiLevelCache.put("red", "apple"); }  @SuppressWarnings("null") static void example(); static void main(String[] args);  }