package com.elab.redis;

import com.elab.redis.config.CacheAutoConfiguration;
import org.junit.runner.RunWith;
import org.redisson.api.RedissonClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * @author ： liukx
 * @time ： 2020/7/8 - 15:14
 */
@RunWith(SpringRunner.class)
@SpringBootTest(
        classes = {RedissonApplication.class, CacheAutoConfiguration.class}
)
//@EnableCaching
public class RedisSpringBoot {
    @Autowired
    protected RedissonClient client;

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    protected void log(Object... text) {
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < text.length; i++) {
            sb.append("--" + text[i].toString() + "--");
        }
        logger.info(sb.toString());
    }

    protected void run(int count, Runnable r) {
        for (int i = 0; i < count; i++) {
            new Thread(r).start();
        }
    }

}
