Caches an object, returning its key.
<p>
If the object has already been cached, its existing key is returned.
</p>

@param value {@link Object} to cache
@return Non-null {@link Integer}
540092
public Integer cache(Object value) {
        synchronized (this) {
            Integer key = keys.get(value);
            // Already cached?
            if (key != null) return key;
            key = next;
            cache.put(key, value);
            keys.put(value, key);
            next++;
            return key;
        }
    }
120594
public static AnyValueMap fromValue(Object value) {
		AnyValueMap result = new AnyValueMap();
		result.setAsObject(value);
		return result;
	}
1366655
def cache(self, value):
        """"""
        value = bool(value)
        if self._cache and not value:
            self._clear()
        self._cache = value
143829
public B set(Object value) {
        data.put(value.getClass().getName(), Objects.requireNonNull(value));
        return (B) this;
    }
616736
function cacheHas(cache, value) {
        var map = cache.__data__;
        if (isKeyable(value)) {
          var data = map.__data__, hash = typeof value == 'string' ? data.string : data.hash;
          return hash[value] === HASH_UNDEFINED;
        }
        return map.has(value);
      }
1136232
def _getCachedValue(obj, relicFunc, resultType):
    
    # If the value has not been previously cached, fetch 
    if not obj.cached:
        obj.cached = resultType()
        relicFunc(byref(obj.cached))
    return obj.cached
831468
@Nullable
    public V get() {
        if (!valueRetrieved) {
            cacheValue = databaseReader.get();
            valueRetrieved = true;
        }
        return cacheValue;
    }
452433
public V put(final Object key, final Object value)
    {
        final Object val = mapNullValue(value);
        requireNonNull(val, "value cannot be null");

        final Object[] entries = this.entries;
        final int mask = entries.length - 1;
        int index = Hashing.evenHash(key.hashCode(), mask);
        Object oldValue = null;

        while (entries[index + 1] != null)
        {
            if (entries[index] == key || entries[index].equals(key))
            {
                oldValue = entries[index + 1];
                break;
            }

            index = next(index, mask);
        }

        if (oldValue == null)
        {
            ++size;
            entries[index] = key;
        }

        entries[index + 1] = val;

        increaseCapacity();

        return unmapNullValue(oldValue);
    }
817435
public V put(K key, V value)
  {
    Entry<V> oldValue = _cache.put(key, new Entry<V>(_expireInterval, value));

    if (oldValue != null)
      return oldValue.getValue();
    else
      return null;
  }
696786
public synchronized void put(T value) {
        cacheMap.put(value.getCacheKey(), new SoftReference<T>(value));
    }
346523
@SuppressWarnings("unchecked")
    public V get(Object key) {
        synchronized( this ) {
            //WeakReference ref;
            SoftReference ref;
            V item;
            
            if( !containsKey(key) ) {
                return null;
            }
            ref = cache.get(key);
            item = (V)ref.get();
            if( item == null ) {
                return null;
            }
            if( item instanceof CachedItem ) {
                CachedItem ci = (CachedItem)item;
                
                if( ci.isValidForCache() ) {
                    return item;
                }
                remove(key);
                return null;
            }
            return item;
        }
    }
1098780
@Override
    public synchronized Object getValue() {
        if (id != null) {
            if (serializedValue != null) {
                long oldSize = -1;
                if (cacheEntryPool != null) {
                    if (cacheEntryPool.cache.isCacheSizeInMBEnabled()) {
                        oldSize = getObjectSize();
                    }
                }

                try {
                    value = SerializationUtility.deserialize(serializedValue, cacheName);
                } catch (Exception ex) {
                    com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.CacheEntry.getValue", "200", this);
                }
                if (value != null) {
                    serializedValue = null;
                    if (cacheEntryPool != null) {
                        if (cacheEntryPool.cache.isCacheSizeInMBEnabled()) {
                            long newSize = getObjectSize();
                            if (oldSize != -1 && newSize != -1) {
                                cacheEntryPool.cache.increaseCacheSizeInBytes(newSize - oldSize, "GET_VALUE");
                            } else {
                                cacheEntryPool.cache.disableCacheSizeInMB();
                            }
                        }
                    }
                }
            }
        }
        return value;
    }
220083
public function key($value)
    {
        if ($value instanceof Cacheable) {
            return $value->cacheId();
        }

        if (is_scalar($value)) {
            return $value;
        }

        if (is_array($value)) {
            return $this->arrayToKey($value);
        }

        if (is_object($value)) {
            return $this->objectToKey($value);
        }

        return null;
    }
920073
public static JSONObject getObject(JSONValue value) {
        if (value == null)
            return null;
        if (!(value instanceof JSONObject))
            throw new JSONException(NOT_AN_OBJECT);
        return (JSONObject)value;
    }
81595
public static Integer getAsInteger(Object value) {
		Integer result = null;

		try {
			if (value instanceof String) {
				result = Integer.valueOf((String) value);
			} else if (value instanceof Number) {
				result = ((Number) value).intValue();
			} else {
				result = null;
			}
		} catch (Exception e) {
			result = null;
		}

		return result == null ? 0 : result;
	}
1139503
@Override
	public void cache(final Object key, final Object object) {
		this.logger.debug("@cache ");

		if (object == null) {
			if (!isAllowNullable()) {
				return;
			}
			this.logger.debug("logging key :", key, " with null");
			getCachableMap(JKAbstractCacheManager.NULLABLE_MAP_CLASS).put(key, null);
		} else {
			cache(key, object, object.getClass());
		}
	}
1065392
public synchronized Object put(final String key, final Object value) {
		try {
			if (maxCacheSize == 0) {
				return null;
			}

			// if the key isn't in the cache and the cache is full...
			if (!super.containsKey(key) && !list.isEmpty()
					&& list.size() + 1 > maxCacheSize) {
				final Object deadKey = list.removeLast();
				super.remove(deadKey);
			}

			updateKey(key);
		} catch (Exception e) {
			log.log(Level.SEVERE, "put", e);
		}
		return super.put(key, value);
	}