| | 21 | {{{ |
| | 22 | public String get(String uri, String key) { |
| | 23 | ... |
| | 24 | |
| | 25 | cache = rRepository.find(key, uri); |
| | 26 | if(cache != null){ |
| | 27 | //不论是否成功 设置hit |
| | 28 | //cache.setHit(cache.getHit()+1);// |
| | 29 | //cache.setHitTime(new Date());// |
| | 30 | |
| | 31 | String content = null; |
| | 32 | try{ |
| | 33 | content = new String(cache.getContent()); |
| | 34 | }catch(Exception e){ |
| | 35 | logger.error("[MongoRClientHelper] get cache:"+uri+" fail,message:"+e.getMessage()); |
| | 36 | rRepository.remove(cache); |
| | 37 | return ""; |
| | 38 | } |
| | 39 | |
| | 40 | //成功了 设置(失败也要置hit) |
| | 41 | //rRepository.save(cache); |
| | 42 | |
| | 43 | logger.debug("[MongoRClientHelper] get cache:"+uri+" success"); |
| | 44 | return content; |
| | 45 | } |
| | 46 | ... |
| | 47 | }}} |