public class TransactionalCache extends Object implements Cache
This class holds all cache entries that are to be added to the 2nd level cache during a Session. Entries are sent to the cache when commit is called or discarded if the Session is rolled back. Blocking cache support has been added. Therefore any get() that returns a cache miss will be followed by a put() so any lock associated with the key can be released.
Constructor and Description |
---|
TransactionalCache(Cache delegate) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears this cache instance.
|
void |
commit() |
String |
getId() |
Object |
getObject(Object key) |
int |
getSize()
Optional.
|
void |
putObject(Object key,
Object object) |
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 |
rollback() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getReadWriteLock
public TransactionalCache(Cache delegate)
public String getId()
public int getSize()
Cache
public Object removeObject(Object key)
Cache
removeObject
in interface Cache
key
- The keypublic void clear()
Cache
public void commit()
public void rollback()
Copyright © 2009–2021 MyBatis.org. All rights reserved.