mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
新增redis方法
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.jsowell.common.core.redis;
|
||||
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -27,7 +26,7 @@ public class RedisCache {
|
||||
public RedisTemplate redisTemplate;
|
||||
|
||||
// redis锁获取超时时间
|
||||
private long timeout = 500l;
|
||||
private long timeout = 500L;
|
||||
|
||||
/**
|
||||
* 缓存基本的对象,Integer、String、实体类等
|
||||
@@ -593,4 +592,15 @@ public class RedisCache {
|
||||
return redisTemplate.opsForHash().increment(key, item, -by);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加充电桩消息到redis
|
||||
*/
|
||||
public void addPileMsg(String redisKey, String newData) {
|
||||
// 执行左推操作
|
||||
redisTemplate.opsForList().leftPush(redisKey, newData);
|
||||
|
||||
// 执行修剪操作,限制列表的最大长度为10
|
||||
redisTemplate.opsForList().trim(redisKey, 0, 9);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user