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

x33g5p2x  于2022-01-18 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(123)

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

Cache.asynchronousPut介绍

[英]Does the asynchronous put into the cache of the asynchronously loaded value.
[中]是否将异步数据放入异步加载值的缓存中。

代码示例

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

/**
 * The load method provides a means to "pre-load" the cache. This method will, asynchronously, load the specified
 * object into the cache using the associated CacheLoader. If the object already exists in the cache, no action is
 * taken. If no loader is associated with the object, no object will be loaded into the cache. If a problem is
 * encountered during the retrieving or loading of the object, an exception should be logged. If the "arg" argument
 * is set, the arg object will be passed to the CacheLoader.load method. The cache will not dereference the object.
 * If no "arg" value is provided a null will be passed to the load method. The storing of null values in the cache
 * is permitted, however, the get method will not distinguish returning a null stored in the cache and not finding
 * the object in the cache. In both cases a null is returned.
 * <p>
 * The Ehcache native API provides similar functionality to loaders using the
 * decorator {@link net.sf.ehcache.constructs.blocking.SelfPopulatingCache}
 *
 * @param key key whose associated value to be loaded using the associated CacheLoader if this cache doesn't contain it.
 *  @throws CacheException in case of error
 */
public void load(final Object key) throws CacheException {
  if (registeredCacheLoaders.size() == 0) {
    LOG.debug("The CacheLoader is null. Returning.");
    return;
  }
  boolean existsOnCall = isKeyInCache(key);
  if (existsOnCall) {
    LOG.debug("The key {} exists in the cache. Returning.", key);
    return;
  }
  asynchronousPut(key, null, null);
}

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

/**
 * The load method provides a means to "pre-load" the cache. This method will, asynchronously, load the specified
 * object into the cache using the associated CacheLoader. If the object already exists in the cache, no action is
 * taken. If no loader is associated with the object, no object will be loaded into the cache. If a problem is
 * encountered during the retrieving or loading of the object, an exception should be logged. If the "arg" argument
 * is set, the arg object will be passed to the CacheLoader.load method. The cache will not dereference the object.
 * If no "arg" value is provided a null will be passed to the load method. The storing of null values in the cache
 * is permitted, however, the get method will not distinguish returning a null stored in the cache and not finding
 * the object in the cache. In both cases a null is returned.
 * <p/>
 * The Ehcache native API provides similar functionality to loaders using the
 * decorator {@link net.sf.ehcache.constructs.blocking.SelfPopulatingCache}
 *
 * @param key key whose associated value to be loaded using the associated CacheLoader if this cache doesn't contain it.
 * @throws CacheException
 */
public void load(final Object key) throws CacheException {
  if (registeredCacheLoaders.size() == 0) {
    LOG.debug("The CacheLoader is null. Returning.");
    return;
  }
  boolean existsOnCall = isKeyInCache(key);
  if (existsOnCall) {
    LOG.debug("The key {} exists in the cache. Returning.", key);
    return;
  }
  asynchronousPut(key, null, null);
}

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

/**
 * The load method provides a means to "pre-load" the cache. This method will, asynchronously, load the specified
 * object into the cache using the associated CacheLoader. If the object already exists in the cache, no action is
 * taken. If no loader is associated with the object, no object will be loaded into the cache. If a problem is
 * encountered during the retrieving or loading of the object, an exception should be logged. If the "arg" argument
 * is set, the arg object will be passed to the CacheLoader.load method. The cache will not dereference the object.
 * If no "arg" value is provided a null will be passed to the load method. The storing of null values in the cache
 * is permitted, however, the get method will not distinguish returning a null stored in the cache and not finding
 * the object in the cache. In both cases a null is returned.
 * <p>
 * The Ehcache native API provides similar functionality to loaders using the
 * decorator {@link net.sf.ehcache.constructs.blocking.SelfPopulatingCache}
 *
 * @param key key whose associated value to be loaded using the associated CacheLoader if this cache doesn't contain it.
 *  @throws CacheException in case of error
 */
public void load(final Object key) throws CacheException {
  if (registeredCacheLoaders.size() == 0) {
    LOG.debug("The CacheLoader is null. Returning.");
    return;
  }
  boolean existsOnCall = isKeyInCache(key);
  if (existsOnCall) {
    LOG.debug("The key {} exists in the cache. Returning.", key);
    return;
  }
  asynchronousPut(key, null, null);
}

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

/**
 * The load method provides a means to "pre-load" the cache. This method will, asynchronously, load the specified
 * object into the cache using the associated CacheLoader. If the object already exists in the cache, no action is
 * taken. If no loader is associated with the object, no object will be loaded into the cache. If a problem is
 * encountered during the retrieving or loading of the object, an exception should be logged. If the "arg" argument
 * is set, the arg object will be passed to the CacheLoader.load method. The cache will not dereference the object.
 * If no "arg" value is provided a null will be passed to the load method. The storing of null values in the cache
 * is permitted, however, the get method will not distinguish returning a null stored in the cache and not finding
 * the object in the cache. In both cases a null is returned.
 * <p/>
 * The Ehcache native API provides similar functionality to loaders using the
 * decorator {@link net.sf.ehcache.constructs.blocking.SelfPopulatingCache}
 *
 * @param key key whose associated value to be loaded using the associated CacheLoader if this cache doesn't contain it.
 * @throws CacheException
 */
public void load(final Object key) throws CacheException {
  if (registeredCacheLoaders.size() == 0) {
    LOG.debug("The CacheLoader is null. Returning.");
    return;
  }
  boolean existsOnCall = isKeyInCache(key);
  if (existsOnCall) {
    LOG.debug("The key {} exists in the cache. Returning.", key);
    return;
  }
  asynchronousPut(key, null, null);
}

相关文章

Cache类方法