MCPcopy
hub / github.com/google/guava / getLiveValue

Method getLiveValue

guava/src/com/google/common/cache/LocalCache.java:1775–1788  ·  view source on GitHub ↗

Gets the value from an entry. Returns null if the entry is invalid, partially-collected, loading, or expired. Unlike {@link Segment#getLiveValue} this method does not attempt to clean up stale entries. As such it should only be called outside a segment context, such as during iteration.

(ReferenceEntry<K, V> entry, long now)

Source from the content-addressed store, hash-verified

1773 * iteration.
1774 */
1775 @Nullable V getLiveValue(ReferenceEntry<K, V> entry, long now) {
1776 if (entry.getKey() == null) {
1777 return null;
1778 }
1779 V value = entry.getValueReference().get();
1780 if (value == null) {
1781 return null;
1782 }
1783
1784 if (isExpired(entry, now)) {
1785 return null;
1786 }
1787 return value;
1788 }
1789
1790 // expiration
1791

Callers 3

isLiveMethod · 0.45
containsValueMethod · 0.45
advanceToMethod · 0.45

Calls 4

isExpiredMethod · 0.95
getKeyMethod · 0.65
getMethod · 0.65
getValueReferenceMethod · 0.65

Tested by

no test coverage detected