Package com.skyline.energy.utils

Examples of com.skyline.energy.utils.Page


    StringBuilder cacheKey = new StringBuilder();

    cacheKey.append(oriKey);

    Page page = CommonUtils.getPageArgument(args, pageIndex);
    if (page != null) {
      cacheKey.append("-p").append(page.getCurpage());
    }

    return cacheKey.toString();
  }
View Full Code Here


    return oriKey;
  }

  public String generatePageKey(Object[] args, String key) {
    Page page = CommonUtils.getPageArgument(args, pageIndex);
    if (page == null) {
      return null;
    }
    if (StringUtils.isEmpty(key)) {
      key = generateCacheKey(args);
View Full Code Here

    Object[] paramArray = CommonUtils.fetchVlaues(getterMethods, parameterIndexes, args, parameterNames);

    initContext(queryDefinition, args, SqlType.READ);

    int pageIndex = queryDefinition.getPageIndex();
    Page page = CommonUtils.getPageArgument(args, pageIndex);
    if (page != null) {
      return getDataAccessor().queryPage(actualSql, page, rowMapper, fetchSize, paramArray);
    }

    LOGGER.info("Query SQL:" + actualSql);
View Full Code Here

    CacheDefinition cacheDefinition = cacheDefinitionCollection.getCacheDefinition();
    Cache cache = cacheResult.getCache();

    if (cacheDefinition.isReturnCollection()) {
      Page page = CommonUtils.getPageArgument(args, cacheDefinition.getPageIndex());
      if (page != null) { // 判断分页参数是非被复用
        String pageKey = cacheDefinition.generatePageKey(args, key);
        LOGGER.debug("缓存为需要分页的缓存,页码(" + page.getCurpage() + "),对应的分页缓存KEY为:" + pageKey);
        Page cachePage = (Page) cache.get(pageKey);
        page.setTotal(cachePage.getTotal());
        cacheResult.setPageKey(pageKey);
      }
    }
    cacheResult.setHit(true);
    return cacheResult;
View Full Code Here

    cache.add(key, newItem, expire);
    LOGGER.debug("缓存对象到:" + key + ",缓存时间:" + expire + "毫秒");

    if (cacheDefinition.isReturnCollection()) {
      int pageIndex = cacheDefinition.getPageIndex();
      Page page = CommonUtils.getPageArgument(args, pageIndex);
      if (page != null) {
        String pageKey = cacheResult.getPageKey();
        if (pageKey == null) {
          pageKey = cacheDefinition.generatePageKey(args, key);
        }
        if (!StringUtils.isEmpty(pageKey)) {
          cache.add(pageKey, page, expire);
          LOGGER.debug("缓存为需要分页的缓存,页码(" + page.getCurpage() + "),缓存分页对象到:" + pageKey + ", 缓存时间:" + expire + "毫秒");
        }
      }
    }

  }
View Full Code Here

TOP

Related Classes of com.skyline.energy.utils.Page

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.