@Test public void getObject() { User user = (User)jedisCacheService.getObject("user01"); logger.info("User name={},age={}",user.getName(),user.getAge()); }
public Object getObject(String key) { Jedis jedis = null; Object object = null; try { jedis = jedisPool.getResource(); byte[] ObjectByteArray = jedis.get(key.getBytes()); object = unserialize(ObjectByteArray); }catch (Exception e){ e.printStackTrace(); }finally { close(jedis); } return object; }
JedisCacheService extends JedisCacheServiceSupport { public Object getObject(String key) { Jedis jedis = null; Object object = null; try { jedis = jedisPool.getResource(); byte[] ObjectByteArray = jedis.get(key.getBytes()); object = unserialize(ObjectByteArray); }catch (Exception e){ e.printStackTrace(); }finally { close(jedis); } return object; } }
JedisCacheService extends JedisCacheServiceSupport { public Object getObject(String key) { Jedis jedis = null; Object object = null; try { jedis = jedisPool.getResource(); byte[] ObjectByteArray = jedis.get(key.getBytes()); object = unserialize(ObjectByteArray); }catch (Exception e){ e.printStackTrace(); }finally { close(jedis); } return object; }  }
JedisCacheService extends JedisCacheServiceSupport { public Object getObject(String key) { Jedis jedis = null; Object object = null; try { jedis = jedisPool.getResource(); byte[] ObjectByteArray = jedis.get(key.getBytes()); object = unserialize(ObjectByteArray); }catch (Exception e){ e.printStackTrace(); }finally { close(jedis); } return object; }  Object getObject(String key); void putObject(String key, Object value); void putObject(String key, Object value, Long expireTime); static byte[] serialize(Object object); static Object unserialize(byte[] bytes); }
JedisCacheService extends JedisCacheServiceSupport { public Object getObject(String key) { Jedis jedis = null; Object object = null; try { jedis = jedisPool.getResource(); byte[] ObjectByteArray = jedis.get(key.getBytes()); object = unserialize(ObjectByteArray); }catch (Exception e){ e.printStackTrace(); }finally { close(jedis); } return object; }  Object getObject(String key); void putObject(String key, Object value); void putObject(String key, Object value, Long expireTime); static byte[] serialize(Object object); static Object unserialize(byte[] bytes);  }