Package com.skyline.energy.cache

Examples of com.skyline.energy.cache.CacheResult


    if (!cacheDefinitionCollection.needCacheOpration()) {
      return dataAccessExecutor.execute(obj, args);
    }

    try {
      CacheResult cacheResult = beforeDataAccess(args);

      Object retVal = dataAccessExecutor.execute(obj, args);
      cacheResult.setRetVal(retVal);
     
      afterDataAccess(cacheResult, args);
     
      return retVal;
    } catch (CacheUnreachableException e) {
View Full Code Here


    }
   
  }

  private CacheResult beforeDataAccess(Object[] args) throws CacheUnreachableException {
    CacheResult cacheResult = new CacheResult(false);

    CacheDefinition cacheDefinition = cacheDefinitionCollection.getCacheDefinition();

    if (cacheDefinition == null) {
      return cacheResult;
    }

    String key = cacheDefinition.generateCacheKey(args);
    if (StringUtils.isEmpty(key)) {
      LOGGER.debug("创建缓存KEY失败,不进行缓存!");
      return cacheResult;
    }
    cacheResult.setKey(key);

    Cache cache = cacheManager.getCache(cacheDefinition.getPool());
    cacheResult.setCache(cache);

    CacheObject oldItem = (CacheObject) cache.get(key);
    LOGGER.debug("从" + key + "获取缓存对象:" + oldItem);
    if (oldItem != null) {
      return compareVersionKey(cacheDefinition, cacheResult, oldItem, args);
View Full Code Here

TOP

Related Classes of com.skyline.energy.cache.CacheResult

Copyright © 2018 www.massapicom. 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.