替换Jedis-使用RedissonClient的StringCodec编解码器

This commit is contained in:
2025-09-15 15:22:51 +08:00
parent 383e64fef4
commit cbb742a26e
3 changed files with 209 additions and 749 deletions

View File

@@ -1,21 +0,0 @@
package com.accompany.common.redis;
public class RedisScript {
//params 红包map的key 红包索引的 key 领取者的key uid 红包id 到期时间
//返回状态 -1 已经领取 -2过期
public static final String RECIVE_RED_PACKET = "local uid = ARGV[1] " + "local reId = ARGV[2] "
+ "local indexKey = KEYS[1] " + "local mapKey = KEYS[2] " + "local reciveKey = KEYS[3] "
+ "local expire = ARGV[3] " + " " + "local hasRecive = redis.call('get',reciveKey) "
+ "if hasRecive == false or hasRecive == nil then "
+ " local redIndex = redis.call('rpop',indexKey) " + " "
+ " if redIndex== false or redIndex == nil then " + " return -2 " + " else "
+ " local value = redis.call('hget',mapKey,redIndex) "
+ " if value == false or value == nil then " + " return -2 " + " end "
+ " redis.call('hdel',mapKey,redIndex) " + " redis.call('set',reciveKey,uid) "
+ " redis.call('expireat',reciveKey,expire) " + " return value " + " end "
+ "else " + " return -1 " + "end ";
public static final int RECIVE_RED_PACKET_KEY_COUNT = 3;
}

View File

@@ -141,7 +141,7 @@ public class PrivatePhotoService extends BaseService{
}
private void deletePhotoCache(Long pid, Long uid) {
jedisService.hdelete(RedisKey.private_photo.getKey() + uid, String.valueOf(pid), null);
jedisService.hdelete(RedisKey.private_photo.getKey() + uid, String.valueOf(pid));
jedisService.hdel(RedisKey.user_summary.getKey(), uid.toString());
}