net.sf.ehcache.Ehcache.getAll()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(180)

本文整理了Java中net.sf.ehcache.Ehcache.getAll()方法的一些代码示例,展示了Ehcache.getAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ehcache.getAll()方法的具体详情如下:
包路径:net.sf.ehcache.Ehcache
类名称:Ehcache
方法名:getAll

Ehcache.getAll介绍

[英]Gets all the elements from the cache for the keys provided. Updates Element Statistics Throws a NullPointerException if any key in the collection is null

Note that the Element's lastAccessTime is always the time of this get. Use #getQuiet(Object) to peek into the Element to see its last access time with get
[中]从缓存中获取所提供密钥的所有元素。如果集合中的任何键为null,则更新元素统计信息将引发NullPointerException
请注意,元素的lastAccessTime始终是此get的时间。使用#getQuiet(Object)查看元素,查看其使用get的最后访问时间

代码示例

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * {@inheritDoc}
 */
public Map<Object, Element> getAll(Collection<?> keys) throws IllegalStateException, CacheException {
  return underlyingCache.getAll(keys);
}

代码示例来源:origin: net.sf.ehcache/ehcache

/**
* {@inheritDoc}
*/
public Map getAll(Collection arg0) throws IllegalStateException, CacheException, NullPointerException {
  // THIS IS GENERATED CODE -- DO NOT HAND MODIFY!
  Thread t = Thread.currentThread();
  ClassLoader prev = t.getContextClassLoader();
  t.setContextClassLoader(this.classLoader);
  try {
    return this.cache.getAll(arg0);
  } finally {
    t.setContextClassLoader(prev);
  }
}

代码示例来源:origin: net.sf.ehcache.internal/ehcache-core

/**
 * {@inheritDoc}
 */
public Map<Object, Element> getAll(Collection<?> keys) throws IllegalStateException, CacheException {
  return underlyingCache.getAll(keys);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache

/**
 * {@inheritDoc}
 */
public Map<Object, Element> getAll(Collection<?> keys) throws IllegalStateException, CacheException {
  return underlyingCache.getAll(keys);
}

代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache

/**
 * {@inheritDoc}
 */
public Map<Object, Element> getAll(Collection<?> keys) throws IllegalStateException, CacheException {
  return underlyingCache.getAll(keys);
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

@Override
public Map<K, V> getAll(Set<? extends K> keys) {
  HashMap<K, V> map = new HashMap<>();
  if (!keys.isEmpty()) {
    Map<Object, Element> mapElements = cache.getAll(keys);
    for (Map.Entry<Object, Element> entry : mapElements.entrySet()) {
      map.put((K)entry.getKey(), (V)entry.getValue().getObjectValue());
    }
  }
  return map;
}

代码示例来源:origin: net.sf.ehcache.internal/ehcache-core

/**
* {@inheritDoc}
*/
public Map getAll(Collection arg0) throws IllegalStateException, CacheException, NullPointerException {
  // THIS IS GENERATED CODE -- DO NOT HAND MODIFY!
  Thread t = Thread.currentThread();
  ClassLoader prev = t.getContextClassLoader();
  t.setContextClassLoader(this.classLoader);
  try {
    return this.cache.getAll(arg0);
  } finally {
    t.setContextClassLoader(prev);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache

/**
* {@inheritDoc}
*/
public Map getAll(Collection arg0) throws IllegalStateException, CacheException, NullPointerException {
  // THIS IS GENERATED CODE -- DO NOT HAND MODIFY!
  Thread t = Thread.currentThread();
  ClassLoader prev = t.getContextClassLoader();
  t.setContextClassLoader(this.classLoader);
  try {
    return this.cache.getAll(arg0);
  } finally {
    t.setContextClassLoader(prev);
  }
}

代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache

/**
* {@inheritDoc}
*/
public Map getAll(Collection arg0) throws IllegalStateException, CacheException, NullPointerException {
  // THIS IS GENERATED CODE -- DO NOT HAND MODIFY!
  Thread t = Thread.currentThread();
  ClassLoader prev = t.getContextClassLoader();
  t.setContextClassLoader(this.classLoader);
  try {
    return this.cache.getAll(arg0);
  } finally {
    t.setContextClassLoader(prev);
  }
}

代码示例来源:origin: org.apereo.cas/cas-server-support-ehcache-ticket-registry

private static Map<Object, Element> getAllExpired(final Ehcache map) {
    try {
      return map.getAll(map.getKeysWithExpiryCheck());
    } catch (final Exception e) {
      LOGGER.warn(e.getMessage(), e);
      return new HashMap<>(0);
    }
  }
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

void logCacheState(String operator) {
  if (cacheDebug) {
    String name = m_callCache.getName();
    net.sf.ehcache.Ehcache ehcache = m_callCache.unwrap(Ehcache.class); // DEBUGGING ONLY
    StringBuilder entriesSB = new StringBuilder();
    List keys = ehcache.getKeysWithExpiryCheck(); // only current keys
    entriesSB.append("   * keys(").append(keys.size()).append("):").append(new ArrayList<Object>(keys)).append("\n");
    Collection<Element> entries = ehcache.getAll(keys).values();
    int countMaps = 0;
    for (Element element : entries) {
      if (element == null) continue;
      int count = 0;
      countMaps += count;
      if (cacheDebugDetailed) {
        entriesSB.append("   ").append(element.getObjectKey()).append(" => (").append(count).append(")").append(element.getObjectValue()).append("\n");
      }
    }
    log.info("SScache:"+name+":: "+operator+" ::\n  entries(Ehcache[key => payload],"+keys.size()+" + "+countMaps+" = "+(keys.size()+countMaps)+"):\n"+entriesSB);
  }
}

代码示例来源:origin: org.ehcache/jcache

@Override
public Map<K, V> getAll(final Set<? extends K> keys) {
  checkNotClosed();
  for (K key : keys) {
    if(key == null) throw new NullPointerException();
  }
  final Map<K, V> result = new HashMap<K, V>();
  final Map<Object, Element> all = ehcache.getAll(keys);
  for (Map.Entry<Object, Element> entry : all.entrySet()) {
    final Element e = entry.getValue();
    final K key = (K)entry.getKey();
    if(key != null) {
      V value = null;
      if(e != null) {
        value = (V)e.getObjectValue();
      } else if (cfg.isReadThrough()) {
        value = load(key);
      }
      if (value != null) {
        result.put(key, value);
      }
    }
  }
  return result;
}

代码示例来源:origin: ehcache/ehcache-jcache

@Override
public Map<K, V> getAll(final Set<? extends K> keys) {
  checkNotClosed();
  for (K key : keys) {
    if(key == null) throw new NullPointerException();
  }
  final Map<K, V> result = new HashMap<K, V>();
  final Map<Object, Element> all = ehcache.getAll(keys);
  for (Map.Entry<Object, Element> entry : all.entrySet()) {
    final Element e = entry.getValue();
    final K key = (K)entry.getKey();
    if(key != null) {
      V value = null;
      if(e != null) {
        value = (V)e.getObjectValue();
      } else if (cfg.isReadThrough()) {
        value = load(key);
      }
      if (value != null) {
        result.put(key, value);
      }
    }
  }
  return result;
}

相关文章

Ehcache类方法