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

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

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

Ehcache.getWithLoader介绍

[英]This method will return, from the cache, the object associated with the argument "key".

If the object is not in the cache, the associated cache loader will be called. That is either the CacheLoader passed in, or if null, the one associated with the cache. If both are null, no load is performed and null is returned.

Because this method may take a long time to complete, it is not synchronized. The underlying cache operations are synchronized.
[中]此方法将从缓存返回与参数“key”关联的对象。
如果对象不在缓存中,将调用关联的缓存加载程序。这是传入的CacheLoader,如果为null,则是与缓存关联的CacheLoader。如果两者都为null,则不执行加载并返回null。
由于此方法可能需要很长时间才能完成,因此不同步。底层缓存操作是同步的。

代码示例

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

/**
 * {@inheritDoc}
 */
public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException {
  return underlyingCache.getWithLoader(key, loader, loaderArgument);
}

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

/**
* {@inheritDoc}
*/
public Element getWithLoader(Object arg0, CacheLoader arg1, Object arg2) throws CacheException {
  // THIS IS GENERATED CODE -- DO NOT HAND MODIFY!
  Thread t = Thread.currentThread();
  ClassLoader prev = t.getContextClassLoader();
  t.setContextClassLoader(this.classLoader);
  try {
    return this.cache.getWithLoader(arg0, arg1, arg2);
  } finally {
    t.setContextClassLoader(prev);
  }
}

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

/**
 * {@inheritDoc}
 */
public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException {
  return underlyingCache.getWithLoader(key, loader, loaderArgument);
}

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

/**
 * {@inheritDoc}
 */
public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException {
  return underlyingCache.getWithLoader(key, loader, loaderArgument);
}

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

/**
 * {@inheritDoc}
 */
public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException {
  return underlyingCache.getWithLoader(key, loader, loaderArgument);
}

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

/**
* {@inheritDoc}
*/
public Element getWithLoader(Object arg0, CacheLoader arg1, Object arg2) throws CacheException {
  // THIS IS GENERATED CODE -- DO NOT HAND MODIFY!
  Thread t = Thread.currentThread();
  ClassLoader prev = t.getContextClassLoader();
  t.setContextClassLoader(this.classLoader);
  try {
    return this.cache.getWithLoader(arg0, arg1, arg2);
  } finally {
    t.setContextClassLoader(prev);
  }
}

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

/**
* {@inheritDoc}
*/
public Element getWithLoader(Object arg0, CacheLoader arg1, Object arg2) throws CacheException {
  // THIS IS GENERATED CODE -- DO NOT HAND MODIFY!
  Thread t = Thread.currentThread();
  ClassLoader prev = t.getContextClassLoader();
  t.setContextClassLoader(this.classLoader);
  try {
    return this.cache.getWithLoader(arg0, arg1, arg2);
  } finally {
    t.setContextClassLoader(prev);
  }
}

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

/**
* {@inheritDoc}
*/
public Element getWithLoader(Object arg0, CacheLoader arg1, Object arg2) throws CacheException {
  // THIS IS GENERATED CODE -- DO NOT HAND MODIFY!
  Thread t = Thread.currentThread();
  ClassLoader prev = t.getContextClassLoader();
  t.setContextClassLoader(this.classLoader);
  try {
    return this.cache.getWithLoader(arg0, arg1, arg2);
  } finally {
    t.setContextClassLoader(prev);
  }
}

代码示例来源:origin: com.madgag/mini-git-server-server

public Element getWithLoader(Object key, CacheLoader loader,
  Object loaderArgument) throws CacheException {
 return self().getWithLoader(key, loader, loaderArgument);
}

代码示例来源:origin: rtyley/mini-git-server

public Element getWithLoader(Object key, CacheLoader loader,
  Object loaderArgument) throws CacheException {
 return self().getWithLoader(key, loader, loaderArgument);
}

代码示例来源:origin: com.atlassian.cache/atlassian-cache-ehcache

@SuppressWarnings("unchecked")
@Nonnull
@Override
public V get(@Nonnull final K key, @Nonnull final com.atlassian.cache.Supplier<? extends V> valueSupplier)
{
  try
  {
    Element element = unwrap(delegate.getWithLoader(wrap(key), getCacheLoader(valueSupplier), null));
    return (V) element.getObjectValue();
  }
  catch (net.sf.ehcache.CacheException e)
  {
    throw new CacheException(e.getCause());
  }
  catch (Exception e)
  {
    throw new CacheException(e);
  }
}

代码示例来源:origin: com.googlecode.ehcache-spring-annotations/ehcache-spring-annotations

final Element element = cache.getWithLoader(cacheKey, null, methodInvocation);
if (element != null) {
  final Object value = element.getObjectValue();

相关文章

Ehcache类方法