package com.union;

import com.alibaba.fastjson.JSON;
import com.union.ai.api.dao.mapper.ext.AppApiMapperExt;
import com.union.ai.api.dao.model.AppApi;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * Author: xingxin.jing
 * Date: 2019/4/11
 * Time: 下午8:27
 */
@Slf4j
public class CacheTest extends BaseTest {

    @Autowired
    private AppApiMapperExt appApiMapperExt;

    @Test
    public void selectCache() throws InterruptedException {
        List<AppApi> appApis = appApiMapperExt.queryByAppAndUrl(10, "/api/check2");
//        System.out.println(JSON.toJSONString(appApis));
        log.info("1------" + JSON.toJSONString(appApis));
        List<AppApi> appApis1 = appApiMapperExt.queryByAppAndUrl(10, "/api/check2");
        log.info("2------" + JSON.toJSONString(appApis1));
        Thread.sleep(5000);
        List<AppApi> appApis2 = appApiMapperExt.queryByAppAndUrl(10, "/api/check2");
        log.info("3------" + JSON.toJSONString(appApis2));
    }
}
