Example #1
0
 /* 这里 对象要实现 序列化接口  zhp 20140609 */
 @Test
 public void testSaveCached() {
   Member m = new Member();
   m.setMemberName("shenhua");
   try {
     baseCacheProxy.set("shenhua", "shenhua", m, lineCacheTime);
     System.out.println("已经放入了!!1");
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Example #2
0
  /* 将 刚刚存入 缓存的对象获取出来 根据 key zhp 20140609 */
  @Test
  public void testGetCached() {
    Member m = null;
    try {
      m = (Member) baseCacheProxy.get("shenhua", "shenhua");
    } catch (Exception e) {
      e.printStackTrace();
    }

    if (m != null) {
      System.out.println(m.getMemberName() + "从缓存中获取的...");
    } else {
      System.out.println("没有获取到");
    }
  }