当使用jedis的set时,同一个key在被set两次后,通过get得到的还是第一次set的值,所以要先del掉key再进行set。 set使用api,原因是参数nxxx的设置问题 String redis.clients.jedis.Jedis.set(String key, String value, String nxxx, String expx, long time) Set the string value as value of the key. The string can't be longer than 1073741824 bytes (1 GB). Parameters:
- key
- value
- nxxx NX|XX, NX -- Only set the key if it does not already exist. XX
-- Only set the key if it already exist.
- expx EX|PX, expire time units: EX = seconds; PX = milliseconds
- time expire time in the units of {@param #expx}
- Returns:
- Status code reply
|