| | |
| | | package com.nuvole.four.service; |
| | | |
| | | import com.nuvole.four.domain.extend.AppDTO; |
| | | import org.apache.commons.lang.StringEscapeUtils; |
| | | import org.apache.commons.lang3.StringEscapeUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.*; |
| | |
| | | Map map = new HashMap(); |
| | | // todo xuekang |
| | | // StringEscapeUtils.unescapeHtml4(key) |
| | | map.put("key",StringEscapeUtils.unescapeHtml(key)); |
| | | map.put("key", StringEscapeUtils.unescapeHtml4(key)); |
| | | map.put("value",value); |
| | | dto.setMap(map); |
| | | AppDTO s = new AppDTO(); |
| | |
| | | ValueOperations<Serializable, Object> operations = redisTemplate.opsForValue(); |
| | | AppDTO dto = new AppDTO(); |
| | | Map map = new HashMap(); |
| | | map.put("key",StringEscapeUtils.unescapeHtml(key)); |
| | | map.put("key",StringEscapeUtils.unescapeHtml4(key)); |
| | | map.put("value",value); |
| | | map.put("expireTime",expireTime); |
| | | map.put("timeUnit",timeUnit); |
| | |
| | | */ |
| | | public void remove(final String key) { |
| | | if (exists(key)) { |
| | | redisTemplate.delete(StringEscapeUtils.unescapeHtml(key)); |
| | | redisTemplate.delete(StringEscapeUtils.unescapeHtml4(key)); |
| | | } |
| | | } |
| | | |
| | |
| | | public boolean exists(final String key) { |
| | | AppDTO dto = new AppDTO(); |
| | | Map map = new HashMap(); |
| | | map.put("key",StringEscapeUtils.unescapeHtml(key)); |
| | | map.put("key",StringEscapeUtils.unescapeHtml4(key)); |
| | | dto.setMap(map); |
| | | AppDTO s = new AppDTO(); |
| | | BeanUtils.copyProperties(dto,s); |
| | |
| | | ValueOperations<Serializable, Object> operations = redisTemplate.opsForValue(); |
| | | AppDTO dto = new AppDTO(); |
| | | Map map = new HashMap(); |
| | | map.put("key",StringEscapeUtils.unescapeHtml(key)); |
| | | map.put("key",StringEscapeUtils.unescapeHtml4(key)); |
| | | dto.setMap(map); |
| | | AppDTO s = new AppDTO(); |
| | | BeanUtils.copyProperties(dto,s); |