Adding to usage list before to hashmap for better concurrency.

This commit is contained in:
Harrison Deng 2020-04-30 14:53:48 -05:00
parent 50ee956ce7
commit 0eb2a13d14
2 changed files with 2 additions and 1 deletions

View File

@ -35,8 +35,8 @@ public class Cache<K, V> {
CacheValue<K, V> val = new CacheValue<>();
val.key = key;
val.value = value;
data.put(key, val);
usage.add(val);
data.put(key, val);
if (data.size() > maxSize) {
data.remove(usage.pop().key);
}

View File

@ -0,0 +1 @@
Start-Process java -ArgumentList "-Xms512M", "-Xmx4G", "-jar", "paper-195.jar", "nogui"