Java Code Examples for org.cache2k.Cache#getAll()
The following examples show how to use
org.cache2k.Cache#getAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SlowExpiryTest.java From cache2k with Apache License 2.0 | 6 votes |
@Test public void testExpireNoKeepSharpExpiryBeyondSafetyGap() { HeapCache.Tunable t = TunableFactory.get(HeapCache.Tunable.class); final Cache<Integer, Integer> c = cache = builder(Integer.class, Integer.class) .loader(new IntCountingCacheSource()) .expireAfterWrite(t.sharpExpirySafetyGapMillis + 3, TimeUnit.MILLISECONDS) .keepDataAfterExpired(false) .sharpExpiry(true) .build(); c.getAll(toIterable(1, 2, 3)); await(new Condition() { @Override public boolean check() throws Exception { return getInfo().getTimerEventCount() >= 3; } }); }
Example 2
Source File: SlowExpiryTest.java From cache2k with Apache License 2.0 | 6 votes |
@Test public void testExpireNoKeepSharpExpiry() { final Cache<Integer, Integer> c = cache = builder(Integer.class, Integer.class) .loader(new IntCountingCacheSource()) .expireAfterWrite(3, TimeUnit.MILLISECONDS) .keepDataAfterExpired(false) .sharpExpiry(true) .build(); c.getAll(toIterable(1, 2, 3)); await(new Condition() { @Override public boolean check() throws Exception { return getInfo().getSize() == 0; } }); }
Example 3
Source File: BasicCacheTest.java From cache2k with Apache License 2.0 | 5 votes |
@Test public void testBulkGetAllReadThrough() { Cache<Integer, Integer> c = freshCache(Integer.class, Integer.class, new IdentIntSource(), 100, -1); Set<Integer> _requestedKeys = new HashSet<Integer>(Arrays.asList(2, 3)); Map<Integer, Integer> m = c.getAll(_requestedKeys); assertEquals(2, m.size()); assertEquals(2, (int) m.get((int) 2)); assertEquals(3, (int) m.get((int) 3)); assertNull(m.get(47)); }
Example 4
Source File: ExpiryTest.java From cache2k with Apache License 2.0 | 4 votes |
@Test public void rejectNull_skipLoaderException_null_getAll_empty() { Cache<Integer, Integer> c = cacheNoNullNoLoaderException(); Map<Integer, Integer> map = c.getAll(toIterable(1, 2 ,3)); assertEquals(0, map.size()); }