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

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

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

Ehcache.remove介绍

[英]Removes an net.sf.ehcache.Element from the Cache. This also removes it from any stores it may be in.

Also notifies the CacheEventListener after the element was removed.
[中]移除一个网。旧金山。ehcache。元素从缓存中删除。这也会将其从任何存储中删除。
还将在删除元素后通知CacheEventListener。

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
public void evict(Object key) {
  this.cache.remove(key);
}

代码示例来源:origin: spring-projects/spring-security

public void removeUserFromCache(String username) {
  cache.remove(username);
}

代码示例来源:origin: spring-projects/spring-security

public void removeTicketFromCache(final String serviceTicket) {
  cache.remove(serviceTicket);
}

代码示例来源:origin: org.springframework/spring-context-support

@Override
public void evict(Object key) {
  this.cache.remove(key);
}

代码示例来源:origin: apache/kylin

public void evict(Object key) {
  this.cache.remove(key);
}

代码示例来源:origin: AxonFramework/AxonFramework

@Override
public <K> boolean remove(K key) {
  return ehCache.remove(key);
}

代码示例来源:origin: jooby-project/jooby

@Override
public void delete(final String id) {
 cache.remove(id);
}

代码示例来源:origin: org.springframework.security/spring-security-core

public void removeUserFromCache(String username) {
  cache.remove(username);
}

代码示例来源:origin: gocd/gocd

public boolean remove(String key) {
  synchronized (key.intern()) {
    Object value = getWithoutTransactionCheck(key);
    if (value instanceof KeyList) {
      for (String subKey : (KeyList) value) {
        ehCache.remove(compositeKey(key, subKey));
      }
    }
    return ehCache.remove(key);
  }
}

代码示例来源:origin: spring-projects/spring-security

public void evictFromCache(Serializable pk) {
  Assert.notNull(pk, "Primary key (identifier) required");
  MutableAcl acl = getFromCache(pk);
  if (acl != null) {
    cache.remove(acl.getId());
    cache.remove(acl.getObjectIdentity());
  }
}

代码示例来源:origin: spring-projects/spring-security

public void evictFromCache(ObjectIdentity objectIdentity) {
  Assert.notNull(objectIdentity, "ObjectIdentity required");
  MutableAcl acl = getFromCache(objectIdentity);
  if (acl != null) {
    cache.remove(acl.getId());
    cache.remove(acl.getObjectIdentity());
  }
}

代码示例来源:origin: apache/shiro

/**
 * Removes the element which matches the key.
 *
 * <p>If no element matches, nothing is removed and no Exception is thrown.</p>
 *
 * @param key the key of the element to remove
 */
public V remove(K key) throws CacheException {
  if (log.isTraceEnabled()) {
    log.trace("Removing object from cache [" + cache.getName() + "] for key [" + key + "]");
  }
  try {
    V previous = get(key);
    cache.remove(key);
    return previous;
  } catch (Throwable t) {
    throw new CacheException(t);
  }
}

代码示例来源:origin: spring-projects/spring-security

@Test
public void evictCacheSerializable() throws Exception {
  when(cache.get(acl.getObjectIdentity()))
      .thenReturn(new Element(acl.getId(), acl));
  myCache.evictFromCache(acl.getObjectIdentity());
  verify(cache).remove(acl.getId());
  verify(cache).remove(acl.getObjectIdentity());
}

代码示例来源:origin: spring-projects/spring-security

@Test
  public void evictCacheObjectIdentity() throws Exception {
    when(cache.get(acl.getId())).thenReturn(new Element(acl.getId(), acl));

    myCache.evictFromCache(acl.getId());

    verify(cache).remove(acl.getId());
    verify(cache).remove(acl.getObjectIdentity());
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void evictData(Object key) {
  try {
    getCache().remove( key );
  }
  catch (ClassCastException | IllegalStateException e) {
    throw new CacheException( e );
  }
  catch (net.sf.ehcache.CacheException e) {
    if ( e instanceof NonStopCacheException ) {
      HibernateNonstopCacheExceptionHandler.getInstance()
          .handleNonstopCacheException( (NonStopCacheException) e );
    }
    else {
      throw new CacheException( e );
    }
  }
}

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

/**
 * {@inheritDoc}
 */
public boolean remove(Object key, boolean doNotNotifyCacheReplicators) throws IllegalStateException {
  return underlyingCache.remove(key, doNotNotifyCacheReplicators);
}

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

/**
 * {@inheritDoc}
 */
public boolean remove(Serializable key, boolean doNotNotifyCacheReplicators) throws IllegalStateException {
  return underlyingCache.remove(key, doNotNotifyCacheReplicators);
}

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

/**
 * {@inheritDoc}
 */
public boolean remove(Serializable key) throws IllegalStateException {
  return underlyingCache.remove(key);
}

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

/**
 * {@inheritDoc}
 */
@Override
public void remove(Object key) throws CacheException {
  try {
    ehcache.remove(key);
  } catch (net.sf.ehcache.CacheException e) {
    throw new CacheException(e);
  }
}

代码示例来源:origin: gravitee-io/gravitee-gateway

private void saveOrUpdate(ApiKey apiKey) {
  if (apiKey.isRevoked() || apiKey.isPaused()) {
    logger.debug("Remove a paused / revoked api-key from cache [key: {}] [plan: {}] [app: {}]", apiKey.getKey(), apiKey.getPlan(), apiKey.getApplication());
    cache.remove(apiKey.getKey());
  } else {
    logger.debug("Cache an api-key [key: {}] [plan: {}] [app: {}]", apiKey.getKey(), apiKey.getPlan(), apiKey.getApplication());
    cache.put(new Element(apiKey.getKey(), apiKey));
  }
}

相关文章

Ehcache类方法