/**
  * Get the objects that have been cached.
  *
  * @return
  */
 public Collection<? extends Cacheable> objectValues() {
   Collection<Cacheable> objects = new ArrayList<Cacheable>();
   for (CachedObject co : values()) {
     objects.add((Cacheable) co.getValue());
   }
   return objects;
 }
 /**
  * Convenience method to add an object with its key to the cache. This creates the CachedObject
  * wrapper to manage its state. If the object already exists in the cache, it updates its value.
  *
  * @param cacheable
  * @return
  */
 public CachedObject add(Cacheable cacheable) {
   Identifier key = cacheable.getIdentifier();
   CachedObject co = get(key);
   if (co == null) {
     co = new CachedObject();
     co.setKey(key.toString());
     put(key, co);
   }
   co.setValue(cacheable);
   return co;
 }
  /**
   * Using this rather than {@link #add} will let you cache anything you please, even objects (like
   * connections to servers) that are not inherently {@link
   * edu.uiuc.ncsa.security.core.Identifiable}.
   *
   * @param key
   * @param value
   * @return
   */
  public CachedObject put(Identifier key, CachedObject value) {
    // issue is that the sorted list is a list -- adding the same cached value
    // repeatedly will result in duplicates. The real cache vets these by key.
    // It is entirely possible that a user will add a new cached object that will replace
    // a currently cached object, effectively changing how the retention policy will work with
    // it.

    CachedObject oldCO = getTheRealCache().get(key);
    if (oldCO == null) {
      // it's new
      getTheRealCache().put(key, value);
      getSortedList().add(value);

    } else {
      oldCO.setTimestamp(value.getTimestamp());
    }
    return oldCO;
  }
 public void put(CachedObject co) {
   put(new BasicIdentifier(co.getKey()), co);
 }