当前位置: 首页>>代码示例>>Java>>正文


Java Cache.invalidateAll方法代码示例

本文整理汇总了Java中com.google.common.cache.Cache.invalidateAll方法的典型用法代码示例。如果您正苦于以下问题:Java Cache.invalidateAll方法的具体用法?Java Cache.invalidateAll怎么用?Java Cache.invalidateAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.cache.Cache的用法示例。


在下文中一共展示了Cache.invalidateAll方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testStatementLifecycle

import com.google.common.cache.Cache; //导入方法依赖的package包/类
@Test public void testStatementLifecycle() throws Exception {
  ConnectionSpec.getDatabaseLock().lock();
  try (AvaticaConnection connection = (AvaticaConnection) getLocalConnection()) {
    Map<Integer, AvaticaStatement> clientMap = connection.statementMap;
    Cache<Integer, Object> serverMap = getLocalConnectionInternals()
        .getRemoteStatementMap(connection);
    // Other tests being run might leave statements in the cache.
    // The lock guards against more statements being cached during the test.
    serverMap.invalidateAll();
    assertEquals(0, clientMap.size());
    assertEquals(0, serverMap.size());
    Statement stmt = connection.createStatement();
    assertEquals(1, clientMap.size());
    assertEquals(1, serverMap.size());
    stmt.close();
    assertEquals(0, clientMap.size());
    assertEquals(0, serverMap.size());
  } finally {
    ConnectionSpec.getDatabaseLock().unlock();
  }
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:22,代码来源:RemoteDriverTest.java

示例2: testConnectionIsolation

import com.google.common.cache.Cache; //导入方法依赖的package包/类
@Test public void testConnectionIsolation() throws Exception {
  ConnectionSpec.getDatabaseLock().lock();
  try {
    Cache<String, Connection> connectionMap = getLocalConnectionInternals()
        .getRemoteConnectionMap((AvaticaConnection) getLocalConnection());
    // Other tests being run might leave connections in the cache.
    // The lock guards against more connections being cached during the test.
    connectionMap.invalidateAll();

    final String sql = "select * from (values (1, 'a'))";
    assertEquals("connection cache should start empty",
        0, connectionMap.size());
    Connection conn1 = getLocalConnection();
    Connection conn2 = getLocalConnection();
    assertEquals("we now have two connections open",
        2, connectionMap.size());
    PreparedStatement conn1stmt1 = conn1.prepareStatement(sql);
    assertEquals(
        "creating a statement does not cause new connection",
        2, connectionMap.size());
    PreparedStatement conn2stmt1 = conn2.prepareStatement(sql);
    assertEquals(
        "creating a statement does not cause new connection",
        2, connectionMap.size());
    AvaticaPreparedStatement s1 = (AvaticaPreparedStatement) conn1stmt1;
    AvaticaPreparedStatement s2 = (AvaticaPreparedStatement) conn2stmt1;
    assertFalse("connection id's should be unique",
        s1.handle.connectionId.equalsIgnoreCase(s2.handle.connectionId));
    conn2.close();
    assertEquals("closing a connection closes the server-side connection",
        1, connectionMap.size());
    conn1.close();
    assertEquals("closing a connection closes the server-side connection",
        0, connectionMap.size());
  } finally {
    ConnectionSpec.getDatabaseLock().unlock();
  }
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:39,代码来源:RemoteDriverTest.java

示例3: clearConfigCache

import com.google.common.cache.Cache; //导入方法依赖的package包/类
/**
 * Clear config cache
 */
protected void clearConfigCache() {
  synchronized (this) {
    for (Cache c : allCaches) {
      if (c != null) {
        c.invalidateAll();
      }
    }
    m_configVersion.incrementAndGet();
  }
}
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:14,代码来源:AbstractConfig.java

示例4: invalidateAll

import com.google.common.cache.Cache; //导入方法依赖的package包/类
public void invalidateAll() {
    for(Cache<Object, Object> subcache : cache.asMap().values()) {
        subcache.invalidateAll();
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:6,代码来源:InMemoryTaskArtifactCache.java

示例5: deleteOAuthTokensEvent

import com.google.common.cache.Cache; //导入方法依赖的package包/类
@Override
public void deleteOAuthTokensEvent(DeleteOAuthTokensEvent event)
{
	Cache<String, OAuthUserState> userCache = getUserCache(CurrentInstitution.get());
	userCache.invalidateAll(event.getTokens());
}
 
开发者ID:equella,项目名称:Equella,代码行数:7,代码来源:OAuthWebServiceImpl.java

示例6: remove

import com.google.common.cache.Cache; //导入方法依赖的package包/类
public void remove(String cacheName, String key) {
    Cache<String, Object> cache = getCacheHolder(cacheName);
    if (cache != null) {
        cache.invalidateAll();
    }
}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:7,代码来源:GuavaLevel1CacheProvider.java

示例7: clearAll

import com.google.common.cache.Cache; //导入方法依赖的package包/类
public void clearAll() {
    for (Cache<String, Object> cache : caches.values()) {
        cache.invalidateAll();
    }
}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:6,代码来源:GuavaLevel1CacheProvider.java


注:本文中的com.google.common.cache.Cache.invalidateAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。