Beispiel #1
0
 /**
  * 设置数据到redis
  *
  * @param key key
  * @param value 值
  * @author 杨雪令
  * @time 2016年5月18日上午11:46:03
  * @version 1.0
  */
 public void putToRedis(String key, Object value) {
   if (this.key == null || this.key.length() < 1) return;
   Map<String, Object> paramMap = syncFromRedis();
   if (paramMap == null) paramMap = new HashMap<String, Object>();
   paramMap.put(key, value);
   JedisUtil.set(this.key, paramMap, timeout * 60);
 }
Beispiel #2
0
 /**
  * 同步数据到redis
  *
  * @author 杨雪令
  * @time 2016年5月18日上午11:46:03
  * @version 1.0
  */
 public void syncToRedis() {
   if (this.key == null || this.key.length() < 1) return;
   Map<String, Object> paramMap = new HashMap<String, Object>();
   for (String valueName : httpSession.getValueNames()) {
     paramMap.put(valueName, httpSession.getAttribute(valueName));
   }
   JedisUtil.set(this.key, paramMap, timeout * 60);
 }
Beispiel #3
0
 /**
  * 从redis中删除数据
  *
  * @param key key
  * @author 杨雪令
  * @time 2016年5月18日上午11:46:03
  * @version 1.0
  */
 public void deleteFromRedis(String key) {
   if (this.key == null || this.key.length() < 1) return;
   Map<String, Object> paramMap = syncFromRedis();
   if (paramMap != null && paramMap.containsKey(key)) {
     paramMap.remove(key);
   }
   JedisUtil.set(this.key, paramMap, timeout * 60);
 }