redis
tuonas
努力成为架构师!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
实现布隆过滤器的三种方式
1、谷歌布隆过滤器原创 2020-10-09 20:09:12 · 1313 阅读 · 0 评论 -
解决redis-cli乱码问题
@Configuration @EnableCaching public class RedisConfig { @Bean public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory factory){ RedisTemplate<String, String> redisTemplate = new RedisTemplate<String,String原创 2020-10-07 20:54:14 · 295 阅读 · 0 评论 -
redis实现分布式锁
项目地址 https://gitee.com/quancong/redis 1、通过setnx、setex命令实现 @Scheduled(cron = "0/10 * * * * *") public void lockJob() { String lock = LOCK_PREFIX + "LockNxExJob"; boolean nxRet = false; try{ //redistemplate setnx原创 2020-10-07 20:36:57 · 243 阅读 · 0 评论 -
mac版git上传本地代码到码云
1、 https://gitee.com/projects/new 码云上新建一个仓库,输入仓库名称,公开,选择语言为Java,新建过后复制那条链接。 2、 找到要上传代码的文件夹,输入 git init git add . git commit -m 'first commit' git push -u origin master 可能遇到: 打开mac钥匙串访问,输入一下码云的地址以及用户名密码。 再次执行: git push -u origin master 刷新一下码云原创 2020-10-07 17:33:08 · 414 阅读 · 0 评论 -
redis发布订阅模式
1、订阅端 127.0.0.1:6379> subscribe tuonas # 订阅了一个tuonas的频道 subscribe tuonas 1 2、发布端 127.0.0.1:6379> publish tuonas 'hello' # 向tuonas这个频道发布一条hello的消息 (integer) 1 3、再回到订阅端看看 127.0.0.1:6379> subscribe tuonas subscribe tuonas 1 message # 消息 tuonas #原创 2020-10-07 14:39:41 · 124 阅读 · 0 评论 -
redis中key命名规范
1、以主键和属性名作为key 表名:主键名:主键值:字段名 eg1: order: id: 26379: name eg2: user: id: 35786: articles → 876983 2、以json格式存储 eg: user: id: 34734858 → {id: 34734858, name: 张三, articles: 876983} ...原创 2020-10-06 19:10:47 · 2043 阅读 · 0 评论 -
解决redis三大问题
public String getKey(String key){ String value = redis.get(key); if(value == null){ String mutexKey = "mutex:key:"+key; //设置互斥锁的key if(redis.set(mutexKey,"1","ex 180","nx")){ //给这个key上一把锁,ex表示只有一个线程能执行,过 期时间为180秒value = db.get(key); redis.set(key,v原创 2020-10-09 20:01:29 · 906 阅读 · 0 评论
分享