예제 #1
0
  /**
   * Store an object in the map. The object's timeout period will start from the current system
   * time.
   */
  public V put(K key, V value) {

    CachedObject<V> cache = map.get(key);

    if (cache == null) {
      map.put(key, new CachedObject<V>(value, timeout));
      return null;
    }
    V old = cache.get();
    cache.set(value);
    return old;
  }