Lines Matching defs:value

72      * Returns the value for {@code key} if it exists in the cache or can be
73 * created by {@code #create}. If a value was returned, it is moved to the
74 * head of the queue. This returns null if a value is not cached and cannot
93 * Attempt to create a value. This may take a long time, and the map
94 * may be different when create() returns. If a conflicting value was
95 * added to the map while create() was working, we leave that value in
96 * the map and release the created value.
126 * Caches {@code value} for {@code key}. The value is moved to the head of
129 * @return the previous value mapped by {@code key}.
131 public final V put(K key, V value) {
132 if (key == null || value == null) {
133 throw new NullPointerException("key == null || value == null");
139 size += safeSizeOf(key, value);
140 previous = map.put(key, value);
147 entryRemoved(false, key, previous, value);
164 V value;
177 value = toEvict.getValue();
179 size -= safeSizeOf(key, value);
183 entryRemoved(true, key, value, null);
190 * @return the previous value mapped by {@code key}.
214 * invoked when a value is evicted to make space, removed by a call to
223 * @param newValue the new value for {@code key}, if it exists. If non-null,
230 * Called after a cache miss to compute a value for the corresponding key.
231 * Returns the computed value or null if no value can be computed. The
237 * <p>If a value for {@code key} exists in the cache when this method
238 * returns, the created value will be released with {@link #entryRemoved}
241 * thread calls {@link #put} while another is creating a value for the same
248 private int safeSizeOf(K key, V value) {
249 int result = sizeOf(key, value);
251 throw new IllegalStateException("Negative size: " + key + "=" + value);
257 * Returns the size of the entry for {@code key} and {@code value} in
263 protected int sizeOf(K key, V value) {
293 * Returns the number of times {@link #get} returned a value that was
302 * value to be created.
309 * Returns the number of times {@link #create(Object)} returned a value.