public VALUE put(KEY key, VALUE object) {
        CacheEntry<VALUE> entry;
        if (referenceType == ReferenceType.WEAK) {
            entry = new CacheEntry<>(new WeakReference<>(object), null);
        } else if (referenceType == ReferenceType.SOFT) {
            entry = new CacheEntry<>(new SoftReference<>(object), null);
        } else {
            entry = new CacheEntry<>(null, object);
        }

        countPutCountSinceEviction++;
        countPut++;
        if (isExpiring && nextCleanUpTimestamp == 0) {
            nextCleanUpTimestamp = System.currentTimeMillis() + expirationMillis + 1;
        }

        CacheEntry<VALUE> oldEntry;
        synchronized (this) {
            if (values.size() >= maxSize) {
                evictToTargetSize(maxSize - 1);
            }
            oldEntry = values.put(key, entry);
        }
        return getValueForRemoved(oldEntry);
    }
public VALUE put ( KEY key , VALUE object ) { CacheEntry < VALUE > entry ; if ( referenceType == ReferenceType . WEAK ) { entry = new CacheEntry < > ( new WeakReference < > ( object ) , null ) ; } else if ( referenceType == ReferenceType . SOFT ) { entry = new CacheEntry < > ( new SoftReference < > ( object ) , null ) ; } else { entry = new CacheEntry < > ( null , object ) ; } countPutCountSinceEviction ++ ; countPut ++ ; if ( isExpiring && nextCleanUpTimestamp == 0 ) { nextCleanUpTimestamp = System . currentTimeMillis ( ) + expirationMillis + 1 ; } CacheEntry < VALUE > oldEntry ; synchronized ( this ) { if ( values . size ( ) >= maxSize ) { evictToTargetSize ( maxSize - 1 ) ; } oldEntry = values . put ( key , entry ) ; } return getValueForRemoved ( oldEntry ) ; }
Stores an new entry in the cache.