You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.8 KiB
63 lines
2.8 KiB
package com.ynxbd.push.helper;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import io.lettuce.core.RedisClient;
|
|
import io.lettuce.core.api.StatefulRedisConnection;
|
|
import io.lettuce.core.api.sync.RedisCommands;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* @author 李进才
|
|
* @ClassName RedisHelper
|
|
* @Description TODO
|
|
* @date 2023/05/06 16:33:00
|
|
*/
|
|
public class RedisHelper {
|
|
|
|
private static final String PASSWORD = "wx.xbd.cn";
|
|
private static final String HOST = "127.0.0.1";
|
|
private static final String PORT = "6379";
|
|
private static RedisCommands<String, String> redis;
|
|
|
|
private static StatefulRedisConnection<String, String> connection;
|
|
private static RedisClient redisClient;
|
|
|
|
|
|
private RedisHelper() {
|
|
redisClient = RedisClient.create("redis://"+PASSWORD+"@"+HOST+":"+PORT+"/0");
|
|
connection = redisClient.connect();
|
|
redis = connection.sync();
|
|
}
|
|
public static RedisHelper getRedis() {
|
|
return Inner.instance;
|
|
}
|
|
private static class Inner{
|
|
private static final RedisHelper instance = new RedisHelper();
|
|
}
|
|
|
|
public String set(String name, String key, Integer expire){
|
|
String result = redis.set(name,key);
|
|
redis.expire(name,expire);
|
|
return result;
|
|
}
|
|
|
|
public String get(String name){
|
|
return redis.get(name);
|
|
}
|
|
public void close() {
|
|
connection.close();
|
|
redisClient.shutdown();
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
Map<String,String> params = new HashMap<>();
|
|
params.put("description", "昨日门诊2217人;非核酸门诊2184人;在院1188人;入院156人;出院186人;手术16台;微创手术4台;四级手术1台;\\\\r\\\\n今年截至昨日门诊286674人;非核酸门诊271307人;出院20271人;实际开放床1224张;病床使用率97.03%;手术5482台,占比28%;四级手术占比20.38%;微创手术占比18.02%;");
|
|
params.put("url", "https://wx.hhzyy.com//wx3302/tickets/GetPage?t=A95C0ACF523B396D48857B85B82D3A47CA3DC877FEAAE4C6AB1A462C0F18D6BA5757732FA6B8C07234D62391B46725A05152BA217FAB03BAAFEA62592BE23CA74940A3A2CC82F6C4FEA21A67140C1348B1C523EA989469DED47DFD0EE2D029FF9B52C8877A18BF0FC158125764E615376029DD33461D4083C1D1A0CF78FFEAC36F6836E1BB05E7779D165D315EAEEA9EDA71819D3F356436BF59C21FB29EBA4C83DB68514B07BFC951C432A0923F5DD71457F9A9A424400ADB506C43617FF83DEDAB1E337567927557D704325AF06160966B0A66B6F1C5470A3776ACC30730C65994D3B3AB879A728C07268B14E6B7371B1D3EE533018A92C8E871A85C6887285D3A39A660CD87AB6CD5FE759E87445228D519359B1D8C925BECD80FC466FA6C");
|
|
for(int i = 0; i<200; i++){
|
|
System.out.println(Integer.toString(i) +":"+ RedisHelper.getRedis().set(Integer.toString(i), JSONObject.toJSONString(params),86400));
|
|
}
|
|
RedisHelper.getRedis().close();
|
|
}
|
|
}
|
|
|