| | |
| | | * @return |
| | | */ |
| | | public static String getValue(String key){ |
| | | return getJedis().get(DomainContant.COMMON_DOMAIN+key); |
| | | Mapping mapping = getMapping(key); |
| | | return mapping == null ? "":mapping.getValue(); |
| | | } |
| | | |
| | | public static Mapping getMapping(String key){ |
| | | Object obj = SerializeUtil.unserialize(getJedis().get((DomainContant.COMMON_DOMAIN+key).getBytes())); |
| | | if(obj instanceof Mapping){ |
| | | return (Mapping) obj; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param mappings |
| | | */ |
| | | public static void setValue(List<Mapping> mappings){ |
| | | getJedis().set((mappings.get(0).getDomain()+mappings.get(0).getKey()).getBytes(),SerializeUtil.serializeList(mappings)); |
| | | getJedis().set((mappings.get(0).getDomain()).getBytes(),SerializeUtil.serializeList(mappings)); |
| | | } |
| | | |
| | | |