Search in sources :

Example 1 with BlockingCache

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

the class CacheBuilder method setStandardDecorators.

private Cache setStandardDecorators(Cache cache) {
    try {
        MetaObject metaCache = SystemMetaObject.forObject(cache);
        if (size != null && metaCache.hasSetter("size")) {
            metaCache.setValue("size", size);
        }
        if (clearInterval != null) {
            cache = new ScheduledCache(cache);
            ((ScheduledCache) cache).setClearInterval(clearInterval);
        }
        if (readWrite) {
            cache = new SerializedCache(cache);
        }
        cache = new LoggingCache(cache);
        cache = new SynchronizedCache(cache);
        if (blocking) {
            cache = new BlockingCache(cache);
        }
        return cache;
    } catch (Exception e) {
        throw new CacheException("Error building standard cache decorators.  Cause: " + e, e);
    }
}
Also used : BlockingCache(org.apache.ibatis.cache.decorators.BlockingCache) ScheduledCache(org.apache.ibatis.cache.decorators.ScheduledCache) SystemMetaObject(org.apache.ibatis.reflection.SystemMetaObject) MetaObject(org.apache.ibatis.reflection.MetaObject) CacheException(org.apache.ibatis.cache.CacheException) LoggingCache(org.apache.ibatis.cache.decorators.LoggingCache) SynchronizedCache(org.apache.ibatis.cache.decorators.SynchronizedCache) SerializedCache(org.apache.ibatis.cache.decorators.SerializedCache) CacheException(org.apache.ibatis.cache.CacheException)

Aggregations

CacheException (org.apache.ibatis.cache.CacheException)1 BlockingCache (org.apache.ibatis.cache.decorators.BlockingCache)1 LoggingCache (org.apache.ibatis.cache.decorators.LoggingCache)1 ScheduledCache (org.apache.ibatis.cache.decorators.ScheduledCache)1 SerializedCache (org.apache.ibatis.cache.decorators.SerializedCache)1 SynchronizedCache (org.apache.ibatis.cache.decorators.SynchronizedCache)1 MetaObject (org.apache.ibatis.reflection.MetaObject)1 SystemMetaObject (org.apache.ibatis.reflection.SystemMetaObject)1