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

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

本文整理了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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. public boolean remove(String key) {
  2. synchronized (key.intern()) {
  3. Object value = getWithoutTransactionCheck(key);
  4. if (value instanceof KeyList) {
  5. for (String subKey : (KeyList) value) {
  6. ehCache.remove(compositeKey(key, subKey));
  7. }
  8. }
  9. return ehCache.remove(key);
  10. }
  11. }

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

  1. public void evictFromCache(Serializable pk) {
  2. Assert.notNull(pk, "Primary key (identifier) required");
  3. MutableAcl acl = getFromCache(pk);
  4. if (acl != null) {
  5. cache.remove(acl.getId());
  6. cache.remove(acl.getObjectIdentity());
  7. }
  8. }

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

  1. public void evictFromCache(ObjectIdentity objectIdentity) {
  2. Assert.notNull(objectIdentity, "ObjectIdentity required");
  3. MutableAcl acl = getFromCache(objectIdentity);
  4. if (acl != null) {
  5. cache.remove(acl.getId());
  6. cache.remove(acl.getObjectIdentity());
  7. }
  8. }

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

  1. /**
  2. * Removes the element which matches the key.
  3. *
  4. * <p>If no element matches, nothing is removed and no Exception is thrown.</p>
  5. *
  6. * @param key the key of the element to remove
  7. */
  8. public V remove(K key) throws CacheException {
  9. if (log.isTraceEnabled()) {
  10. log.trace("Removing object from cache [" + cache.getName() + "] for key [" + key + "]");
  11. }
  12. try {
  13. V previous = get(key);
  14. cache.remove(key);
  15. return previous;
  16. } catch (Throwable t) {
  17. throw new CacheException(t);
  18. }
  19. }

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

  1. @Test
  2. public void evictCacheSerializable() throws Exception {
  3. when(cache.get(acl.getObjectIdentity()))
  4. .thenReturn(new Element(acl.getId(), acl));
  5. myCache.evictFromCache(acl.getObjectIdentity());
  6. verify(cache).remove(acl.getId());
  7. verify(cache).remove(acl.getObjectIdentity());
  8. }

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

  1. @Test
  2. public void evictCacheObjectIdentity() throws Exception {
  3. when(cache.get(acl.getId())).thenReturn(new Element(acl.getId(), acl));
  4. myCache.evictFromCache(acl.getId());
  5. verify(cache).remove(acl.getId());
  6. verify(cache).remove(acl.getObjectIdentity());
  7. }
  8. }

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

  1. @Override
  2. public void evictData(Object key) {
  3. try {
  4. getCache().remove( key );
  5. }
  6. catch (ClassCastException | IllegalStateException e) {
  7. throw new CacheException( e );
  8. }
  9. catch (net.sf.ehcache.CacheException e) {
  10. if ( e instanceof NonStopCacheException ) {
  11. HibernateNonstopCacheExceptionHandler.getInstance()
  12. .handleNonstopCacheException( (NonStopCacheException) e );
  13. }
  14. else {
  15. throw new CacheException( e );
  16. }
  17. }
  18. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public boolean remove(Object key, boolean doNotNotifyCacheReplicators) throws IllegalStateException {
  5. return underlyingCache.remove(key, doNotNotifyCacheReplicators);
  6. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public boolean remove(Serializable key, boolean doNotNotifyCacheReplicators) throws IllegalStateException {
  5. return underlyingCache.remove(key, doNotNotifyCacheReplicators);
  6. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public boolean remove(Serializable key) throws IllegalStateException {
  5. return underlyingCache.remove(key);
  6. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void remove(Object key) throws CacheException {
  6. try {
  7. ehcache.remove(key);
  8. } catch (net.sf.ehcache.CacheException e) {
  9. throw new CacheException(e);
  10. }
  11. }

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

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

相关文章

Ehcache类方法