src/main/java/com/stoyanr/evictor/map/ConcurrentMapWithTimedEvictionDecorator.java
/**
     * Associates the specified value with the specified key in this map for the
     * specified duration. If the map previously contained a mapping for the
     * key, the old value is replaced by the specified value. (A map <tt>m</tt>
     * is said to contain a mapping for a key <tt>k</tt> if and only if
     * {@link #containsKey(Object) m.containsKey(k)} would return <tt>true</tt>
     * .)
     * 
     * @param key
     *            key with which the specified value is to be associated
     * 
     * @param value
     *            value to be associated with the specified key
     * 
     * @param evictMs
     *            the time in ms during which the entry can stay in the map
     *            (time-to-live). When this time has elapsed, the entry will be
     *            evicted from the map automatically. A value of 0 for this
     *            argument means "forever", i.e. <tt>put(key, value, 0)</tt> is
     *            equivalent to <tt>put(key, value)</tt>.
     * 
     * @return the previous value associated with <tt>key</tt>, or <tt>null</tt>
     *         if there was no mapping for <tt>key</tt>. (A <tt>null</tt> return
     *         can also indicate that the map previously associated
     *         <tt>null</tt> with <tt>key</tt>, if the implementation supports
     *         <tt>null</tt> values.)
     * 
     * @throws UnsupportedOperationException
     *             if the <tt>put</tt> operation is not supported by the
     *             delegate map
     * 
     * @throws ClassCastException
     *             if the class of the specified key or value prevents it from
     *             being stored in this map
     * 
     * @throws NullPointerException
     *             if the specified key is null and the delegate map does not
     *             permit null keys, or if the specified value is null
     * 
     * @throws IllegalArgumentException
     *             if some property of the specified key or value prevents it
     *             from being stored in this map, or if evictMs is negative
     */
Associates the specified value with the specified key in this map for the
specified duration. If the map previously contained a mapping for the
key, the old value is replaced by the specified value. (A map m
is said to contain a mapping for a key k if and only if
#containsKey(Object) m.containsKey(k) would return true
.)

@param key
key with which the specified value is to be associated

@param value
value to be associated with the specified key

@param evictMs
the time in ms during which the entry can stay in the map
(time-to-live). When this time has elapsed, the entry will be
evicted from the map automatically. A value of 0 for this
argument means "forever", i.e.

@return the previous value associated with key, or null
if there was no mapping for key. (A null return
can also indicate that the map previously associated
null with key, if the implementation supports
null values.)

@throws UnsupportedOperationException
if the put operation is not supported by the
delegate map

@throws ClassCastException
if the class of the specified key or value prevents it from
being stored in this map

@throws NullPointerException
if the specified key is null and the delegate map does not
permit null keys, or if the specified value is null

@throws IllegalArgumentException
if some property of the specified key or value prevents it
from being stored in this map, or if evictMs is negative
Associates the specified value with the specified key in this map for the specified duration . If the map previously contained a mapping for the key the old value is replaced by the specified value . ( A map m is said to contain a mapping for a key k if and only if #containsKey ( Object ) m . containsKey ( k ) would return true . ) @param key key with which the specified value is to be associated @param value value to be associated with the specified key @param evictMs the time in ms during which the entry can stay in the map ( time - to - live ) . When this time has elapsed the entry will be evicted from the map automatically . A value of 0 for this argument means " forever " i . e . @return the previous value associated with key or null if there was no mapping for key . ( A null return can also indicate that the map previously associated null with key if the implementation supports null values . ) @throws UnsupportedOperationException if the put operation is not supported by the delegate map @throws ClassCastException if the class of the specified key or value prevents it from being stored in this map @throws NullPointerException if the specified key is null and the delegate map does not permit null keys or if the specified value is null @throws IllegalArgumentException if some property of the specified key or value prevents it from being stored in this map or if evictMs is negative
@Override
    public V put(K key, V value, long evictMs) {
        EvictibleEntry<K, V> e = new EvictibleEntry<K, V>(this, key, value, evictMs);
        EvictibleEntry<K, V> oe = this.delegate.put(key, e);
        if (oe != null) {
            cancelEviction(oe);
        }
        scheduleEviction(e);
        return ((oe == null) || oe.shouldEvict()) ? null : oe.getValue();
    }
@ Override public V put ( K key , V value , long evictMs ) { EvictibleEntry < K , V > e = new EvictibleEntry < K , V > ( this , key , value , evictMs ) ; EvictibleEntry < K , V > oe = this . delegate . put ( key , e ) ; if ( oe != null ) { cancelEviction ( oe ) ; } scheduleEviction ( e ) ; return ( ( oe == null ) || oe . shouldEvict ( ) ) ? null : oe . getValue ( ) ; }
Associates the specified value with the specified key in this map for the
 specified duration.
Associates the specified value with the specified key in this map for the specified duration .
// An entry is being removed, cancel its automatic eviction