suzejing/src/main/java/com/loadCenter/aliyun/gateway/cache/GatewayNodeIDCache.java

47 lines
1.0 KiB
Java

package com.loadCenter.aliyun.gateway.cache;
import com.loadCenter.aliyun.gateway.cache.abs.GatewayNodeCacheAbs;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @ClassName GatewayNodeIDCache
* @Description 节点id缓存
* @Author ZeJinG.Su
* @Date 22:31 2024/4/19
*/
@Component
public class GatewayNodeIDCache extends GatewayNodeCacheAbs<String> {
private final static String gatewayLoadNodeIDKey = "NodeId";
@Override
public String getPre() {
return "gateway:load:";
}
/**
* 增加
* @param gatewayNodeIds
*/
public void put(List<String> gatewayNodeIds) {
this.remove();
redisService.setCacheList(encode(gatewayLoadNodeIDKey), gatewayNodeIds);
}
/**
* 获取
* @return
*/
public List<String> get() {
return redisService.getCacheList(encode(gatewayLoadNodeIDKey));
}
/**
* 删除
*/
public void remove() {
redisService.deleteObject(encode(gatewayLoadNodeIDKey));
}
}