[error prone] suppress NonAtomicVolatileUpdate warning in SimpleLruCache
It's not important to update time field, scalability is more important than perfect LRU ordering of cache entries. Change-Id: I22466c580cd3613b81e1989130b2724af9d6c466 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
66cb2d9db4
commit
b4cb06b294
|
@ -159,6 +159,7 @@ public SimpleLruCache(int maxSize, float purgeFactor) {
|
|||
*
|
||||
* @return value mapped for this key, or {@code null} if no value is mapped
|
||||
*/
|
||||
@SuppressWarnings("NonAtomicVolatileUpdate")
|
||||
public V get(Object key) {
|
||||
Entry<K, V> entry = map.get(key);
|
||||
if (entry != null) {
|
||||
|
@ -185,6 +186,7 @@ public V get(Object key) {
|
|||
* @throws NullPointerException
|
||||
* if the specified key or value is null
|
||||
*/
|
||||
@SuppressWarnings("NonAtomicVolatileUpdate")
|
||||
public V put(@NonNull K key, @NonNull V value) {
|
||||
map.put(key, new Entry<>(key, value, ++time));
|
||||
if (map.size() > maximumSize) {
|
||||
|
|
Loading…
Reference in New Issue