public static List<Province> getAllProvinceFromCache() {

    Cache cache = CacheItemManager.getCache(CacheName.DB_CACHE_PROVINCE);

    Attribute<Integer> id = cache.getSearchAttribute("id");

    Query query = cache.createQuery().includeValues().addCriteria(id.notNull());

    Results results = query.execute();
    List<Result> rs = results.all();

    if (rs == null || rs.size() <= 0) {

      return null;
    }

    int size = rs.size();
    List<Province> list = new ArrayList<Province>();

    for (int i = 0; i < size; ++i) {

      list.add((Province) rs.get(i).getValue());
    }

    results.discard();

    return list;
  }
  public static List<AreaView> getAllAreaFromCache() {

    Cache cache = CacheItemManager.getCache(CacheName.DB_CACHE_AREA);

    Attribute<String> areacode =
        cache.getSearchAttribute(SearchAttributeName.DBCACHE_AREA_AREACODE);

    Query query =
        cache
            .createQuery()
            .includeAttribute(areacode)
            .includeValues()
            .addCriteria(areacode.notNull())
            .addOrderBy(areacode, Direction.ASCENDING);
    Results results = query.execute();

    List<Result> rs = results.all();

    if (rs == null || rs.size() <= 0) {
      return null;
    }

    int size = rs.size();
    List<AreaView> list = new ArrayList<AreaView>();

    for (int i = 0; i < size; ++i) {

      list.add((AreaView) rs.get(i).getValue());
    }
    results.discard();
    return list;
  }