Esempio n. 1
0
  /**
   * Returns all currently cached descendant URIs.
   *
   * @param uri
   * @return
   */
  public List<Path> getCachedDescendantPaths(Path uri) {
    List<Path> paths = new ArrayList<Path>();

    for (Path cachedUri : this.items.uriSet()) {
      if (uri.isAncestorOf(cachedUri)) {
        paths.add(cachedUri);
      }
    }

    return paths;
  }
Esempio n. 2
0
    public synchronized void remove(final Path uri, boolean removeDescendants) {
      Item item = this.map.remove(uri);
      if (item != null) {
        // Something was actually removed
        --this.size;
        removeFromEvictionQueue(item);
      }

      if (removeDescendants) {
        for (Iterator<Map.Entry<Path, Item>> iter = this.map.entrySet().iterator();
            iter.hasNext(); ) {
          Map.Entry<Path, Item> entry = iter.next();

          if (uri.isAncestorOf(entry.getKey())) {
            removeFromEvictionQueue(entry.getValue());
            iter.remove();
            --this.size;
          }
        }
      }
    }