Example #1
0
  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));
    }
  }
Example #2
0
  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);
    }
  }