Search in sources :

Example 6 with LoggingCache

use of org.apache.ibatis.cache.decorators.LoggingCache in project mybatis-3 by mybatis.

the class ScheduledCacheTest method shouldRemoveItemOnDemand.

@Test
public void shouldRemoveItemOnDemand() {
    Cache cache = new PerpetualCache("DefaultCache");
    cache = new ScheduledCache(cache);
    ((ScheduledCache) cache).setClearInterval(60000);
    cache = new LoggingCache(cache);
    cache.putObject(0, 0);
    assertNotNull(cache.getObject(0));
    cache.removeObject(0);
    assertNull(cache.getObject(0));
}
Also used : PerpetualCache(org.apache.ibatis.cache.impl.PerpetualCache) ScheduledCache(org.apache.ibatis.cache.decorators.ScheduledCache) LoggingCache(org.apache.ibatis.cache.decorators.LoggingCache) LoggingCache(org.apache.ibatis.cache.decorators.LoggingCache) PerpetualCache(org.apache.ibatis.cache.impl.PerpetualCache) ScheduledCache(org.apache.ibatis.cache.decorators.ScheduledCache) Test(org.junit.Test)

Aggregations

LoggingCache (org.apache.ibatis.cache.decorators.LoggingCache)6 ScheduledCache (org.apache.ibatis.cache.decorators.ScheduledCache)6 PerpetualCache (org.apache.ibatis.cache.impl.PerpetualCache)5 Test (org.junit.Test)4 SerializedCache (org.apache.ibatis.cache.decorators.SerializedCache)3 SynchronizedCache (org.apache.ibatis.cache.decorators.SynchronizedCache)3 BlockingCache (org.apache.ibatis.cache.decorators.BlockingCache)2 HashSet (java.util.HashSet)1 Cache (org.apache.ibatis.cache.Cache)1 CacheException (org.apache.ibatis.cache.CacheException)1 LruCache (org.apache.ibatis.cache.decorators.LruCache)1 MetaObject (org.apache.ibatis.reflection.MetaObject)1 SystemMetaObject (org.apache.ibatis.reflection.SystemMetaObject)1