I am writing a message pull center on the sever side with redis, MsgEntity
is javabean to represent a message:
package com.pipeline;
public class MsgEntity {
private String msgId;
private String content;
private int expire ;
public String getMsgId() {
return msgId;
}
public void setMsgId(String msgId) {
this.msgId = msgId;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public int getExpire() {
return expire;
}
public void setExpire(int expire) {
this.expire = expire;
}
}
I need to store a message entity as hash structure in redis, the key is msgId
, my demand is traverse all message in redis, I use ShardedJedis
in java to guarantee performance, so unlike Jedis
, there is no keys
mothod for me to get all keys in redis, is there any way to fix this?
Maybe List
is helpful, but since expire
time exists, and no way to set an item's expire time in List
, I don't think it really helpful.
Thanks ahead.