Example usage for org.apache.ibatis.cache Cache clear

List of usage examples for org.apache.ibatis.cache Cache clear

Introduction

In this page you can find the example usage for org.apache.ibatis.cache Cache clear.

Prototype

void clear();

Source Link

Document

Clears this cache instance.

Usage

From source file:com.ibatis.sqlmap.engine.builder.FlushCacheInterceptor.java

License:Apache License

public Object intercept(Invocation invocation) throws Throwable {
    MappedStatement statement = (MappedStatement) invocation.getArgs()[0];
    if (statement != null) {
        Set<Cache> cachesToFlush = flushCacheMap.get(statement.getId());
        if (cachesToFlush != null) {
            for (Cache c : cachesToFlush) {
                c.clear();
            }//from   www . jav  a  2 s. c  o m
        }
    }
    return invocation.proceed();
}

From source file:com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.java

License:Apache License

public void flushDataCache() {
    for (Cache c : configuration.getCaches()) {
        c.clear();
    }
}

From source file:com.thoughtworks.go.server.dao.DatabaseAccessHelper.java

License:Apache License

public void onSetUp() throws Exception {
    databaseTester.onSetup();//from w  w  w .  j  a va 2s . c  o  m
    pipelineTimeline.clearWhichIsEvilAndShouldNotBeUsedInRealWorld();
    if (sqlMapClient != null) {
        for (Cache cache : sqlMapClient.getConfiguration().getCaches()) {
            cache.clear();
        }
    }
}

From source file:org.mybatis.caches.hazelcast.BaseHazelcastTestCase.java

License:Apache License

@Test
public void shouldFlushAllItemsOnDemand() {
    Cache cache = newCache();
    for (int i = 0; i < 5; i++) {
        cache.putObject(i, i);/*w ww .  j ava  2  s. c om*/
    }
    assertNotNull(cache.getObject(0));
    assertNotNull(cache.getObject(4));
    cache.clear();
    assertNull(cache.getObject(0));
    assertNull(cache.getObject(4));
}