56 lines
1.1 KiB
Java
56 lines
1.1 KiB
Java
package com.muyu.gateway.cache;
|
|
|
|
import com.muyu.common.constant.CacheConstants;
|
|
import com.muyu.gateway.cache.abs.GatewayCacheAbs;
|
|
import com.muyu.gateway.model.NodeVehicle;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
/**
|
|
* @Author: wanghao //作者
|
|
* @CreateDate: 2024/4/18 20:23 //创建时间
|
|
*/
|
|
|
|
|
|
@Component
|
|
public class NodeSetVinCache extends GatewayCacheAbs<String> {
|
|
|
|
|
|
@Override
|
|
public String getPre() {
|
|
return CacheConstants.GATEWAY_VEHICLE;
|
|
}
|
|
|
|
/**
|
|
* 存入车辆信息
|
|
* @param nodeVehicle
|
|
*/
|
|
public void put(NodeVehicle nodeVehicle){
|
|
redisService.setCacheObject(encode(nodeVehicle.getVehicleVin()),nodeVehicle);
|
|
}
|
|
|
|
/**
|
|
* 获取车辆节点ID
|
|
* @param vehicleVin 车辆VIN
|
|
* @return 返回节点ID
|
|
*/
|
|
public String get(String vehicleVin){
|
|
return redisService.getCacheObject(encode(vehicleVin));
|
|
}
|
|
|
|
/**
|
|
* 删除车辆信息
|
|
* @param vehicleVin 车辆VIN
|
|
*/
|
|
public void delete(String vehicleVin){
|
|
redisService.deleteObject(encode(vehicleVin));
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|