Commit d6f0352c authored by alex yao's avatar alex yao

优化记忆函数主键

parent 4428dadb
......@@ -374,7 +374,8 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
public List<AgentLongMemoryDto> getLongMemoryList(String agentId) {
Assert.notNull(agentId);
List<AgentLongMemoryDto> result = new ArrayList<>();
String contentKey = SetLongMemoryConstants.REDIS_PREFIX + agentId + ":" + BlContext.getCurrentUserNotException().getUserId().toString();
String key = agentId + ":" + agentId;
String contentKey = SetLongMemoryConstants.REDIS_PREFIX + key + ":" + BlContext.getCurrentUserNotException().getUserId().toString();
Map<Object, Object> map = redisService.hmget(contentKey);
Set<Object> keySet = map.keySet();
......@@ -391,14 +392,16 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
public void deleteLongMemoryByKey(String agentId, String timestamp) {
Assert.notNull(agentId);
Assert.notNull(timestamp);
String contentKey = SetLongMemoryConstants.REDIS_PREFIX + agentId + ":" + BlContext.getCurrentUserNotException().getUserId().toString();
String key = agentId + ":" + agentId;
String contentKey = SetLongMemoryConstants.REDIS_PREFIX + key + ":" + BlContext.getCurrentUserNotException().getUserId().toString();
redisService.hdel(contentKey, timestamp);
}
@Override
public void deleteLongMemory(String agentId) {
Assert.notNull(agentId);
String contentKey = SetLongMemoryConstants.REDIS_PREFIX + agentId + ":" + BlContext.getCurrentUserNotException().getUserId().toString();
String key = agentId + ":" + agentId;
String contentKey = SetLongMemoryConstants.REDIS_PREFIX + key + ":" + BlContext.getCurrentUserNotException().getUserId().toString();
redisService.del(contentKey);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment