本文整理了Java中org.ehcache.Cache.iterator()
方法的一些代码示例,展示了Cache.iterator()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cache.iterator()
方法的具体详情如下:
包路径:org.ehcache.Cache
类名称:Cache
方法名:iterator
暂无
代码示例来源:origin: ehcache/ehcache3
@Test
public void iterator() {
cache.put(1, "a");
cache.put(2, "b");
changesOf(0, 0, 2, 0);
Iterator<Cache.Entry<Integer, String>> iterator = cache.iterator();
changesOf(1, 0, 0, 0); // FIXME Why one?!?
iterator.next().getKey();
changesOf(1, 0, 0, 0); // FIXME One hit and on the cache we have two
expect(iterator.hasNext()).isTrue();
changesOf(0, 0, 0, 0);
iterator.next().getKey();
changesOf(0, 0, 0, 0); // FIXME No hit on a next
expect(iterator.hasNext()).isFalse();
changesOf(0, 0, 0, 0);
iterator.remove();
changesOf(1, 0, 0, 1); // FIXME remove does hit
}
代码示例来源:origin: ehcache/ehcache3
@Test
public void iterator() {
cache.put(1, "a");
cache.put(2, "b");
changesOf(0, 0, 2, 0);
Iterator<Cache.Entry<Integer, String>> iterator = cache.iterator();
changesOf(1, 0, 0, 0); // FIXME Why one?!?
iterator.next().getKey();
changesOf(2, 0, 0, 0); // FIXME Why two?!?
expect(iterator.hasNext()).isTrue();
changesOf(0, 0, 0, 0);
iterator.next().getKey();
changesOf(1, 0, 0, 0);
expect(iterator.hasNext()).isFalse();
changesOf(0, 0, 0, 0);
iterator.remove();
changesOf(1, 0, 0, 1); // FIXME remove does hit
}
代码示例来源:origin: ehcache/ehcache3
Iterator<Cache.Entry<Long, String>> iterator = txCache1.iterator();
while (iterator.hasNext()) {
Cache.Entry<Long, String> next = iterator.next();
Iterator<Cache.Entry<Long, String>> iterator = txCache1.iterator();
while (iterator.hasNext()) {
Cache.Entry<Long, String> next = iterator.next();
代码示例来源:origin: org.ehcache.integrations.shiro/shiro-ehcache3
@Override
public Iterator<K> iterator() {
return new EhcacheIterator<K, V, K>(cache.iterator()) {
protected K getNext(Iterator<org.ehcache.Cache.Entry<K, V>> cacheIterator) {
return cacheIterator.next().getKey();
}
};
}
};
代码示例来源:origin: org.ehcache.integrations.shiro/shiro-ehcache3
@Override
public Iterator<V> iterator() {
return new EhcacheIterator<K, V, V>(cache.iterator()) {
protected V getNext(Iterator<org.ehcache.Cache.Entry<K, V>> cacheIterator) {
return cacheIterator.next().getValue();
}
};
}
};
代码示例来源:origin: org.ehcache.integrations.shiro/shiro-ehcache3
@Override
public boolean isEmpty() {
return !ehcacheCache.iterator().hasNext();
}
代码示例来源:origin: org.ehcache.integrations.shiro/shiro-ehcache3
public int size() {
Iterator<org.ehcache.Cache.Entry<K, V>> iterator = cache.iterator();
int size = 0;
while (iterator.hasNext()) {
iterator.next();
size++;
}
return size;
}
代码示例来源:origin: nuls-io/nuls
public Set<K> keySet() {
Cache cache = this.cacheManager.getCache(cacheName);
if (null == cache) {
return new HashSet<>();
}
Iterator it = cache.iterator();
Set<K> set = new HashSet<>();
while (it.hasNext()) {
Cache.Entry<K, V> entry = (Cache.Entry<K, V>) it.next();
set.add((K) entry.getKey());
}
return set;
}
代码示例来源:origin: nuls-io/nuls
public List<V> values() {
if (cacheManager == null || null == cacheManager.getCache(cacheName)) {
return new ArrayList<>();
}
Iterator it = cacheManager.getCache(cacheName).iterator();
List<V> list = new ArrayList<>();
while (it.hasNext()) {
Cache.Entry<K, V> entry = (Cache.Entry<K, V>) it.next();
V t = entry.getValue();
list.add(t);
}
return list;
}
代码示例来源:origin: haifeiWu/lightconf
/**
* refresh conf (watch + refresh)
*/
public static void reloadAll() {
Set<String> keySet = new HashSet<>();
Iterator<Cache.Entry<String, CacheNode>> iterator = lightConfLocalCache.iterator();
while (iterator.hasNext()) {
Cache.Entry<String, CacheNode> item = iterator.next();
keySet.add(item.getKey());
}
if (keySet.size() > 1) {
for (String key: keySet) {
String cacheData = LightConfClient.get(key);
lightConfLocalCache.put(key, new CacheNode(cacheData));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!