Sets a new value of an entry. Adds newly created entries at the end of the access queue.
(ReferenceEntry<K, V> entry, K key, V value, long now)
| 2030 | |
| 2031 | /** Sets a new value of an entry. Adds newly created entries at the end of the access queue. */ |
| 2032 | @GuardedBy("this") |
| 2033 | void setValue(ReferenceEntry<K, V> entry, K key, V value, long now) { |
| 2034 | ValueReference<K, V> previous = entry.getValueReference(); |
| 2035 | int weight = map.weigher.weigh(key, value); |
| 2036 | checkState(weight >= 0, "Weights must be non-negative"); |
| 2037 | |
| 2038 | ValueReference<K, V> valueReference = |
| 2039 | map.valueStrength.referenceValue(this, entry, value, weight); |
| 2040 | entry.setValueReference(valueReference); |
| 2041 | recordWrite(entry, weight, now); |
| 2042 | previous.notifyNewValue(value); |
| 2043 | } |
| 2044 | |
| 2045 | // loading |
| 2046 |
no test coverage detected