Redis???????????
???????????? ???????[ 2014/5/30 14:47:13 ] ????????Redis ?洢?? ?????
????3. ????Redis???????
??????????????д???Eclipse?????????jedis???????????????????£?
public class RedisTest {
private Jedis jedis = null;
private String key1 = "key1";
private String key2 = "key2";
public RedisTest() {
jedis = new Jedis("localhost");
}
public static void main(String[] args) {
RedisTest redisTest = new RedisTest();
redisTest.isReachable();
redisTest.testData();
redisTest.delData();
redisTest.testExpire();
}
public boolean isReachable() {
boolean isReached = true;
try {
jedis.connect();
jedis.ping();
// jedis.quit();
} catch (JedisConnectionException e) {
e.printStackTrace();
isReached = false;
}
System.out
.println("The current Redis Server is Reachable:" + isReached);
return isReached;
}
public void testData() {
jedis.set("key1"?? "data1");
System.out.println("Check status of data existing:"
+ jedis.exists(key1));
System.out.println("Get Data key1:" + jedis.get("key1"));
long s = jedis.sadd(key2?? "data2");
System.out.println("Add key2 Data:" + jedis.scard(key2)
+ " with status " + s);
}
public void delData() {
long count = jedis.del(key1);
System.out.println("Get Data Key1 after it is deleted:"
+ jedis.get(key1));
}
public void testExpire() {
long count = jedis.expire(key2?? 5);
try {
Thread.currentThread().sleep(6000);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (jedis.exists(key2)) {
System.out
.println("Get Key2 in Expire Action:" + jedis.scard(key2));
} else {
System.out.println("Key2 is expired with value:"
+ jedis.scard(key2));
}
}
}
|
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
?????????????????????д?ò??????????????????????????????Щ??????????????????????????????????????????????????????????????APP????????????????????????????????????????5??????????????????????SQL?????в??????????Щ???????裿??γ???????????????????????????????Щ???????????????????д?淶???????????????????????????????????????裿
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????