package com.java110.cache;
|
|
import javafx.application.Application;
|
import org.junit.Test;
|
import org.junit.runner.RunWith;
|
import org.springframework.boot.test.SpringApplicationConfiguration;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
/**
|
* Created by wuxw on 2017/7/23.
|
*/
|
@RunWith(SpringJUnit4ClassRunner.class)
|
@SpringApplicationConfiguration(Application.class)
|
public class TestRedis {
|
|
/* @Autowired
|
private StringRedisTemplate stringRedisTemplate;
|
|
@Autowired
|
private RedisTemplate redisTemplate;*/
|
|
@Test
|
public void test() throws Exception {
|
/* stringRedisTemplate.opsForValue().set("aaa", "111");
|
Assert.assertEquals("111", stringRedisTemplate.opsForValue().get("aaa"));*/
|
}
|
|
@Test
|
public void testObj() throws Exception {
|
/*User user=new User("aa@126.com", "aa", "aa123456", "aa","123");
|
ValueOperations<String, User> operations=redisTemplate.opsForValue();
|
operations.set("com.neox", user);
|
operations.set("com.neo.f", user,1,TimeUnit.SECONDS);
|
Thread.sleep(1000);
|
//redisTemplate.delete("com.neo.f");
|
boolean exists=redisTemplate.hasKey("com.neo.f");
|
if(exists){
|
System.out.println("exists is true");
|
}else{
|
System.out.println("exists is false");
|
}*/
|
// Assert.assertEquals("aa", operations.get("com.neo.f").getUserName());
|
}
|
}
|