コード例 #1
0
  /** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  @Override
  public void onEntryAccessed(boolean rmv, EvictableEntry<K, V> entry) {
    if (!entry.isCached()) return;

    IgniteCache<K, V> cache = entry.unwrap(IgniteCache.class);

    int size = cache.localSize(CachePeekMode.ONHEAP);

    for (int i = max; i < size; i++) {
      Cache.Entry<K, V> e = cache.randomEntry();

      if (e != null) e.unwrap(EvictableEntry.class).evict();
    }
  }
コード例 #2
0
  /**
   * Print query results.
   *
   * @param msg Initial message.
   * @param res Results to print.
   */
  private static <V> void printQueryResults(String msg, Iterable<Cache.Entry<Integer, V>> res) {
    System.out.println(msg);

    for (Cache.Entry<?, ?> e : res) System.out.println("    " + e.getValue().toString());
  }