本文整理了Java中net.sf.ehcache.Ehcache.removeElement()
方法的一些代码示例,展示了Ehcache.removeElement()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ehcache.removeElement()
方法的具体详情如下:
包路径:net.sf.ehcache.Ehcache
类名称:Ehcache
方法名:removeElement
[英]Remove the Element mapped to the key for the supplied element if the value of the supplied Element compares equal to the value of the cached Element.
This is equivalent to
if (elementValueComparator.equals(cache.get(element.getObjectKey()), element)) {
return cache.remove(element.getObjectKey());
} else return false;
except that the action is performed atomically.
[中]
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* {@inheritDoc}
*/
public boolean removeElement(Element element) throws NullPointerException {
return underlyingCache.removeElement(element);
}
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* {@inheritDoc}
*/
public boolean removeElement(Element arg0) throws 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.removeElement(arg0);
} finally {
t.setContextClassLoader(prev);
}
}
代码示例来源:origin: gravitee-io/gravitee-gateway
private void saveOrUpdate(Subscription subscription) {
String key = subscription.getApi() + '-' + subscription.getClientId();
Element element = cache.get(subscription.getId());
if ((subscription.getStatus() == Subscription.Status.CLOSED || subscription.getStatus() == Subscription.Status.PAUSED)
&& element != null) {
cache.removeElement(element);
String oldKey = (String) element.getObjectValue();
Element eltSubscription = cache.get(oldKey);
if (eltSubscription != null && ((Subscription)eltSubscription.getObjectValue()).getId().equals(subscription.getId())) {
cache.remove(oldKey);
}
} else {
LOGGER.debug("Cache a subscription: plan[{}] application[{}] client_id[{}]", subscription.getPlan(), subscription.getApplication(), subscription.getClientId());
cache.put(new Element(subscription.getId(), key));
cache.put(new Element(key, subscription));
if (element != null) {
final String oldKey = (String) element.getObjectValue();
if (!oldKey.equals(key)) {
cache.remove(oldKey);
}
}
}
}
代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache
/**
* {@inheritDoc}
*/
public boolean removeElement(Element element) throws NullPointerException {
return underlyingCache.removeElement(element);
}
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
/**
* {@inheritDoc}
*/
public boolean removeElement(Element element) throws NullPointerException {
return underlyingCache.removeElement(element);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
/**
* {@inheritDoc}
*/
public boolean removeElement(Element element) throws NullPointerException {
return underlyingCache.removeElement(element);
}
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
/**
* {@inheritDoc}
*/
public boolean removeElement(Element arg0) throws 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.removeElement(arg0);
} finally {
t.setContextClassLoader(prev);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
/**
* {@inheritDoc}
*/
public boolean removeElement(Element arg0) throws 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.removeElement(arg0);
} finally {
t.setContextClassLoader(prev);
}
}
代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache
/**
* {@inheritDoc}
*/
public boolean removeElement(Element arg0) throws 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.removeElement(arg0);
} finally {
t.setContextClassLoader(prev);
}
}
代码示例来源:origin: com.atlassian.cache/atlassian-cache-ehcache
@Override
public boolean remove(@Nonnull K key, @Nonnull V value)
{
try
{
return delegate.removeElement(new Element(wrap(key), wrap(value)));
}
catch (Exception e)
{
throw new CacheException(e);
}
}
代码示例来源: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);
}
}
代码示例来源: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: ehcache/ehcache-jcache
private Element getElement(final K key) {
final Element element = ehcache.get(key);
if (element == null)
return null;
final Duration expiryForUpdate = cfg.getExpiryPolicy().getExpiryForAccess();
if(expiryForUpdate != null && expiryForUpdate.isZero()) {
ehcache.removeElement(element);
}
return element;
}
代码示例来源:origin: org.ehcache/jcache
private Element getElement(final K key) {
final Element element = ehcache.get(key);
if (element == null)
return null;
final Duration expiryForUpdate = cfg.getExpiryPolicy().getExpiryForAccess();
if(expiryForUpdate != null && expiryForUpdate.isZero()) {
ehcache.removeElement(element);
}
return element;
}
代码示例来源:origin: io.gravitee.gateway.services/gravitee-gateway-services-subscriptions-cache
private void saveOrUpdate(Subscription subscription) {
String key = subscription.getApi() + '-' + subscription.getClientId();
Element element = cache.get(subscription.getId());
if ((subscription.getStatus() == Subscription.Status.CLOSED || subscription.getStatus() == Subscription.Status.PAUSED)
&& element != null) {
cache.removeElement(element);
String oldKey = (String) element.getObjectValue();
Element eltSubscription = cache.get(oldKey);
if (eltSubscription != null && ((Subscription)eltSubscription.getObjectValue()).getId().equals(subscription.getId())) {
cache.remove(oldKey);
}
} else {
LOGGER.debug("Cache a subscription: plan[{}] application[{}] client_id[{}]", subscription.getPlan(), subscription.getApplication(), subscription.getClientId());
cache.put(new Element(subscription.getId(), key));
cache.put(new Element(key, subscription));
if (element != null) {
final String oldKey = (String) element.getObjectValue();
if (!oldKey.equals(key)) {
cache.remove(oldKey);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!