Search in sources :

Example 1 with CacheBuilder

use of org.apache.ibatis.mapping.CacheBuilder in project mybatis-3 by mybatis.

the class MapperBuilderAssistant method useNewCache.

public Cache useNewCache(Class<? extends Cache> typeClass, Class<? extends Cache> evictionClass, Long flushInterval, Integer size, boolean readWrite, boolean blocking, Properties props) {
    Cache cache = new CacheBuilder(currentNamespace).implementation(valueOrDefault(typeClass, PerpetualCache.class)).addDecorator(valueOrDefault(evictionClass, LruCache.class)).clearInterval(flushInterval).size(size).readWrite(readWrite).blocking(blocking).properties(props).build();
    configuration.addCache(cache);
    currentCache = cache;
    return cache;
}
Also used : CacheBuilder(org.apache.ibatis.mapping.CacheBuilder) LruCache(org.apache.ibatis.cache.decorators.LruCache) PerpetualCache(org.apache.ibatis.cache.impl.PerpetualCache) Cache(org.apache.ibatis.cache.Cache) LruCache(org.apache.ibatis.cache.decorators.LruCache)

Aggregations

Cache (org.apache.ibatis.cache.Cache)1 LruCache (org.apache.ibatis.cache.decorators.LruCache)1 PerpetualCache (org.apache.ibatis.cache.impl.PerpetualCache)1 CacheBuilder (org.apache.ibatis.mapping.CacheBuilder)1