Removed unnessecary hashmap retrieval from cache.

This commit is contained in:
Harrison Deng 2020-04-25 02:23:48 -05:00
parent a7db7d289a
commit 1c5baf8762

View File

@ -30,7 +30,7 @@ public class Cache <CacheValueType> {
CacheValue<CacheValueType> val = dataCache.get(identifier); CacheValue<CacheValueType> val = dataCache.get(identifier);
val.identifier.usage++; val.identifier.usage++;
ids.add(val.identifier); ids.add(val.identifier);
return dataCache.get(identifier); return val;
} }
if (ids.size() >= maxCacheSize) { if (ids.size() >= maxCacheSize) {
dataCache.remove(ids.poll()); dataCache.remove(ids.poll());