public class BlockingCache extends Object implements Cache
Simple blocking decorator
Simple and inefficient version of EhCache's BlockingCache decorator. It sets a lock over a cache key when the element is not found in cache. This way, other threads will wait until this element is filled instead of hitting the database.
By its nature, this implementation can cause deadlock when used incorrecly.
| Constructor and Description |
|---|
BlockingCache(Cache delegate) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears this cache instance.
|
String |
getId() |
Object |
getObject(Object key) |
int |
getSize()
Optional.
|
long |
getTimeout() |
void |
putObject(Object key,
Object value) |
Object |
removeObject(Object key)
As of 3.3.0 this method is only called during a rollback
for any previous value that was missing in the cache.
|
void |
setTimeout(long timeout) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetReadWriteLockpublic BlockingCache(Cache delegate)
public String getId()
public int getSize()
Cachepublic Object removeObject(Object key)
CacheremoveObject in interface Cachekey - The keypublic void clear()
Cachepublic long getTimeout()
public void setTimeout(long timeout)
Copyright © 2009–2021 MyBatis.org. All rights reserved.