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

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

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

Ehcache.putWithWriter介绍

[英]Put an element in the cache writing through a CacheWriter. If no CacheWriter has been registered for the cache, then this method throws an exception.

Resets the access statistics on the element, which would be the case if it has previously been gotten from a cache, and is now being put back.

Also notifies the CacheEventListener, if the writer operation succeeds, that:

  • the element was put, but only if the Element was actually put.
  • if the element exists in the cache, that an update has occurred, even if the element would be expired if it was requested
    [中]通过CacheWriter在缓存中写入元素。如果没有为缓存注册CacheWriter,则此方法会引发异常。
    重置元素上的访问统计信息,如果该元素以前是从缓存中获取的,现在又被放回缓存中,则会出现这种情况。
    如果编写器操作成功,还通知CacheEventListener:
    *元素已放置,但仅当元素已实际放置时。
    *如果缓存中存在该元素,则表明已发生更新,即使请求该元素时该元素将过期

代码示例

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

/**
 * {@inheritDoc}
 */
public void putWithWriter(Element element) throws IllegalArgumentException, IllegalStateException, CacheException {
  underlyingCache.putWithWriter(element);
}

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

@Override
  public Void put() {
    underlyingCache.putWithWriter(element);
    return null;
  }
});

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

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

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

@Override
  public Void put() {
    underlyingCache.putWithWriter(element);
    return null;
  }
});

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

/**
 * {@inheritDoc}
 */
public void putWithWriter(Element element) throws IllegalArgumentException, IllegalStateException, CacheException {
  underlyingCache.putWithWriter(element);
}

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

@Override
  public Void put() {
    underlyingCache.putWithWriter(element);
    return null;
  }
});

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

/**
 * {@inheritDoc}
 */
public void putWithWriter(Element element) throws IllegalArgumentException, IllegalStateException, CacheException {
  underlyingCache.putWithWriter(element);
}

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

/**
 * {@inheritDoc}
 */
public void putWithWriter(Element element) throws IllegalArgumentException, IllegalStateException, CacheException {
  cache.putWithWriter(element);
}

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

/**
 * {@inheritDoc}
 */
public void putWithWriter(Element element) throws IllegalArgumentException, IllegalStateException, CacheException {
  underlyingCache.putWithWriter(element);
}

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

@Override
  public Void put() {
    underlyingCache.putWithWriter(element);
    return null;
  }
});

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

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

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

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

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

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

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

private void putAndWriteIfNeeded(final Element element) {
  if (cfg.isWriteThrough()) {
    try {
      ehcache.putWithWriter(element);
    } catch (RuntimeException e) {
      ehcache.removeElement(element);
      throw new CacheWriterException(e);
    }
  } else {
    ehcache.put(element);
  }
}

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

private void putAndWriteIfNeeded(final Element element) {
  if (cfg.isWriteThrough()) {
    try {
      ehcache.putWithWriter(element);
    } catch (RuntimeException e) {
      ehcache.removeElement(element);
      throw new CacheWriterException(e);
    }
  } else {
    ehcache.put(element);
  }
}

相关文章

Ehcache类方法