/**
  * Get the list of keys. This method allows to read the internal state of the cache.
  *
  * @param cold if true, only keys for the cold entries are returned
  * @param nonResident true for non-resident entries
  * @return the key list
  */
 public List<Long> keys(boolean cold, boolean nonResident) {
   ArrayList<Long> keys = new ArrayList<Long>();
   for (Segment<V> s : segments) {
     keys.addAll(s.keys(cold, nonResident));
   }
   return keys;
 }
Example #2
0
  public static Segment shallowCopy(Segment segment, Factory factory) {
    Segment clone = factory.newSegment();
    for (String key : segment.keys()) {
      clone.setAttribute(key, segment.getAttribute(key));
    }

    return clone;
  }