示例#1
0
文件: CacheUpdater.java 项目: ruav/ii
  public void update(String uri) {
    // clean cache by uri

    if (uri.startsWith(UriGenerator.generate(Term.class, ""))) {
      searchController.search(getValueFromUri(Term.class, uri), 0, null);
    } else if (uri.startsWith(UriGenerator.generate(Category.class, ""))) {
      categoryController.getContents(getValueFromUri(Category.class, uri));
    }
  }
示例#2
0
文件: CacheUpdater.java 项目: ruav/ii
  private void updateCacheSearchResult() throws IOException {
    // clean cache for search results

    String uri = UriGenerator.generate(Term.class, "");
    List<CacheEntity> searchCacheList =
        commonDao.getLike(CacheEntity.class, "uri", uri + "%", Integer.MAX_VALUE);

    for (CacheEntity cache : searchCacheList) {
      final SearchResultPage searchResult =
          (SearchResultPage)
              searchController.searchWithoutCache(
                  getValueFromUri(Term.class, cache.getUri()), 0, null);
      cache.setContent(objectMapper.writeValueAsString(searchResult));
      commonDao.save(cache);
    }
  }