949596979899100101102103104
/** * {@inheritDoc} */ public boolean containsKeyInMemory(Object key) { Sync s = sync.getSyncForKey(key); s.lock(LockType.READ); try { return memory.containsKey(key); } finally { s.unlock(LockType.READ); }
114115116117118119120121122123124
/** * {@inheritDoc} */ public boolean containsKeyOnDisk(Object key) { Sync s = sync.getSyncForKey(key); s.lock(LockType.READ); try { if (disk != null) { return disk.containsKey(key); } else { return false;
143144145146147148149150151152153
*/ public void expireElements() { for (Object key : memory.getKeys()) { Sync s = sync.getSyncForKey(key); s.lock(LockType.WRITE); try { Element element = memory.getQuiet(key); if (element != null) { if (element.isExpired(config)) { Element e = remove(key);
180181182183184185186187188189190
/** * {@inheritDoc} */ public Element get(Object key) { Sync s = sync.getSyncForKey(key); s.lock(LockType.READ); try { Element e = memory.get(key); if (e == null && disk != null) { e = disk.get(key); if (e != null) {
286287288289290291292293294295296
/** * {@inheritDoc} */ public Element getQuiet(Object key) { Sync s = sync.getSyncForKey(key); s.lock(LockType.READ); try { Element e = memory.getQuiet(key); if (e == null && disk != null) { e = disk.getQuiet(key); if (e != null) {
341342343344345346347348349350351
if (element == null) { return false; } Sync s = sync.getSyncForKey(element.getObjectKey()); s.lock(LockType.WRITE); try { boolean notOnDisk = !containsKeyOnDisk(element.getObjectKey()); return memory.put(element) && notOnDisk; } finally { s.unlock(LockType.WRITE);
211212213214215216217218219220221
Object value = element.getObjectValue(); Sync lock = getLockForKey(key); if (!lock.isHeldByCurrentThread(LockType.WRITE)) { lock.lock(LockType.WRITE); } try { if (value != null) { underlyingCache.put(element); } else {