Fixed cache locks as they were swapped.

Must've been real tired or something while writing that.
This commit is contained in:
Harrison Deng 2020-04-27 17:06:10 -05:00
parent 3675074d00
commit 250334e348

View File

@ -11,8 +11,8 @@ public class Cache<Key, Value> {
private final ConcurrentHashMap<Key, CacheValue<Value>> data;
private final ConcurrentLinkedQueue<Key> occurrenceOrder;
private ReentrantReadWriteLock cleaningLock = new ReentrantReadWriteLock(true);
private ReadLock writeLock = cleaningLock.readLock();
private WriteLock readLock = cleaningLock.writeLock();
private WriteLock writeLock = cleaningLock.writeLock();
private ReadLock readLock = cleaningLock.readLock();
public Cache(int maxSize) {
data = new ConcurrentHashMap<>(maxSize + 1, 0.75f, 6);