Package com.pccw.hessian.support.cache

Examples of com.pccw.hessian.support.cache.CachePolicy.expires()


 
  //不需要判断policy为null,policy为null,认定为不适用缓存,不会掉用此方法
  @Override
  public boolean ifReturnFromCahce(Method method, Object[] args) {
    CachePolicy policy=method.getAnnotation(CachePolicy.class);
    if(policy.expires() < 0){
      System.out.println("没有有效期,false");
      return false;
    }
    try {
      String key=getCacheKey(method,args);
View Full Code Here


      //String key=policy.keyGenerater().newInstance().generatKey(method, args);System.out.println("生成的缓存key:"+key);
      if(cache.containsKey(key)==false){System.out.println("有缓存规则,但缓存中不存在false");
        return false;
      }
      CacheContainner cc=cache.get(key);
      if((System.currentTimeMillis()-cc.brith) < policy.expires()){System.out.println("有缓存规则,且缓存中存在,且没过期true");
        return true;
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.