Пример #1
0
 /**
  * 获取缓存对象
  *
  * @return 缓存对象
  * @throws WeixinException
  */
 public T getCache() throws WeixinException {
   String cacheKey = cacheCreator.key();
   T cache = cacheStorager.lookup(cacheKey);
   if (cache == null) {
     cache = cacheCreator.create();
     cacheStorager.caching(cacheKey, cache);
   }
   return cache;
 }
Пример #2
0
 /**
  * 移除缓存
  *
  * @return 被移除的缓存对象
  */
 public T evictCache() {
   String cacheKey = cacheCreator.key();
   return cacheStorager.evict(cacheKey);
 }
Пример #3
0
 /**
  * 刷新缓存对象
  *
  * @return 缓存对象
  * @throws WeixinException
  */
 public T refreshCache() throws WeixinException {
   String cacheKey = cacheCreator.key();
   T cache = cacheCreator.create();
   cacheStorager.caching(cacheKey, cache);
   return cache;
 }