java 连接Redis的小例子
程序员文章站
2023-12-20 17:32:16
需要相应api ()
复制代码 代码如下:package com.redis;
import redis.clients.jedis.jedis;
public cl...
需要相应api ()
复制代码 代码如下:
package com.redis;
import redis.clients.jedis.jedis;
public class client {
public void getcache(string key){
jedis jedis = new jedis("127.0.0.1",6379);
for (int i = 0; i < 100000; i++){
jedis.set(string.valueof(i), "kkkk");
}
string value = jedis.get(key);
system.out.println(value);
}
public static void main(string[] args){
client client = new client();
client.getcache("key1");
}
}