Java Code Examples for org.cache2k.Cache#keys()
The following examples show how to use
org.cache2k.Cache#keys() .
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: ClockProEvictionTest.java From cache2k with Apache License 2.0 | 6 votes |
@Test public void test1() { final int _SIZE = 1; Cache<Integer, Integer> c = provideCache(_SIZE); for (int i = 0; i < _SIZE * 2; i++) { c.put(i, i); } for (int i = 0; i < _SIZE * 2; i++) { c.put(i, i); } int _count = 0; for (int k : c.keys()) { _count++; } assertEquals(_SIZE, _count); }
Example 2
Source File: ClockProEvictionTest.java From cache2k with Apache License 2.0 | 6 votes |
@Test public void test30() { final int _SIZE = 30; Cache<Integer, Integer> c = provideCache(_SIZE); for (int i = 0; i < _SIZE * 2; i++) { c.put(i, i); } for (int i = 0; i < _SIZE * 2; i++) { c.put(i, i); } int _count = 0; for (int k : c.keys()) { _count++; } assertEquals(_SIZE, _count); }
Example 3
Source File: ClockProEvictionTest.java From cache2k with Apache License 2.0 | 6 votes |
@Test public void testEvictCold() { final int _SIZE = 30; Cache<Integer, Integer> c = provideCache(_SIZE); for (int i = 0; i < _SIZE / 2; i++) { c.put(i, i); } for (int i = 0; i < _SIZE / 2; i++) { c.put(i, i); } for (int i = 0; i < _SIZE * 2; i++) { c.put(i, i); } int _count = 0; for (int k : c.keys()) { _count++; } assertEquals(_SIZE, _count); }
Example 4
Source File: IteratorTest.java From cache2k with Apache License 2.0 | 5 votes |
@Test public void keyIteration() { Cache<Integer, Integer> c = createCacheWith20Entries(); Set<Integer> _keysSeen = new HashSet<Integer>(); for (Integer i : c.keys()) { _keysSeen.add(i); } assertEquals(20, _keysSeen.size()); c.close(); }
Example 5
Source File: ClockProEvictionTest.java From cache2k with Apache License 2.0 | 5 votes |
public void testEvictHot() { final int _SIZE = 30; Cache<Integer, Integer> c = provideCache(_SIZE); for (int i = 0; i < _SIZE / 2; i++) { c.put(i, i); } for (int i = 0; i < _SIZE / 2; i++) { c.put(i, i); } for (int i = 0; i < _SIZE * 2; i++) { c.put(i, i); } for (int i = _SIZE / 2; i < _SIZE; i++) { c.put(i, i); } for (int i = _SIZE / 2; i < _SIZE; i++) { c.put(i, i); } for (int i = 0; i < _SIZE * 2; i++) { c.put(i, i); } int _count = 0; for (int k : c.keys()) { _count++; } assertEquals(_SIZE, _count); }