摘要:
开门见山,采用算法:Alias离散采样算法 该算法逻辑不详述:可自行查询 优点:查询的时间复杂度O1 在项目中使用分为两步: 1、构建(代码源自链接文章底部) public final class AliasMethod { /* The random number generator used t 阅读全文
摘要:
开门见山,首先定义一个lua脚本文件 脚本文件内容: local key = KEYS[1] local val = redis.call("get", key) if val == false or tonumber(val) < 1 then return false else redis.ca 阅读全文
摘要:
使用Fastjson和Springboot的Converter对全局Long类型统一序列化为字符串类型 直接上代码: 序列化类: public class Serialize2String implements ObjectSerializer { public static final Seria 阅读全文
摘要:
直接上代码: @EnableAsync @Configuration public class AsyncConfig { @Bean public ThreadPoolTaskExecutor threadPoolTaskExecutor() { ThreadPoolTaskExecutor ex 阅读全文
摘要:
直接上代码: public class HttpUtils { private static final RestTemplate restTemplate = new RestTemplate(); // Get请求 public static String Get(String url, Map 阅读全文