Adding to usage list before to hashmap for better concurrency.
This commit is contained in:
parent
50ee956ce7
commit
0eb2a13d14
@ -35,8 +35,8 @@ public class Cache<K, V> {
|
|||||||
CacheValue<K, V> val = new CacheValue<>();
|
CacheValue<K, V> val = new CacheValue<>();
|
||||||
val.key = key;
|
val.key = key;
|
||||||
val.value = value;
|
val.value = value;
|
||||||
data.put(key, val);
|
|
||||||
usage.add(val);
|
usage.add(val);
|
||||||
|
data.put(key, val);
|
||||||
if (data.size() > maxSize) {
|
if (data.size() > maxSize) {
|
||||||
data.remove(usage.pop().key);
|
data.remove(usage.pop().key);
|
||||||
}
|
}
|
||||||
|
1
test-server/start_normal_ram+.ps1
Normal file
1
test-server/start_normal_ram+.ps1
Normal file
@ -0,0 +1 @@
|
|||||||
|
Start-Process java -ArgumentList "-Xms512M", "-Xmx4G", "-jar", "paper-195.jar", "nogui"
|
Loading…
x
Reference in New Issue
Block a user