|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.j256.ormlite.dao.LruObjectCache
public class LruObjectCache
Cache for ORMLite which stores a certain number of items for each Class. Inserting an object into the cache once it
is full will cause the least-recently-used object to be ejected. They can be injected into a dao with the
Dao.setObjectCache(ObjectCache)
.
NOTE: If you set the capacity to be 100 then each Class will allow 100 items in the cache. If you have 5 classes then the cache will hold 500 objects.
Constructor Summary | |
---|---|
LruObjectCache(int capacity)
|
Method Summary | ||
---|---|---|
|
clear(Class<T> clazz)
Remove all entries from the cache of a certain class. |
|
void |
clearAll()
Remove all entries from the cache of all classes. |
|
|
get(Class<T> clazz,
ID id)
Lookup in the cache for an object of a certain class that has a certain id. |
|
|
put(Class<T> clazz,
ID id,
T data)
Put an object in the cache that has a certain class and id. |
|
|
remove(Class<T> clazz,
ID id)
Delete from the cache an object of a certain class that has a certain id. |
|
|
size(Class<T> clazz)
Return the number of elements in the cache. |
|
int |
sizeAll()
Return the number of elements in all of the caches. |
|
|
updateId(Class<T> clazz,
ID oldId,
ID newId)
Change the id in the cache for an object of a certain class from an old-id to a new-id. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LruObjectCache(int capacity)
Method Detail |
---|
public <T,ID> T get(Class<T> clazz, ID id)
ObjectCache
get
in interface ObjectCache
public <T,ID> void put(Class<T> clazz, ID id, T data)
ObjectCache
put
in interface ObjectCache
public <T> void clear(Class<T> clazz)
ObjectCache
clear
in interface ObjectCache
public void clearAll()
ObjectCache
clearAll
in interface ObjectCache
public <T,ID> void remove(Class<T> clazz, ID id)
ObjectCache
remove
in interface ObjectCache
public <T,ID> T updateId(Class<T> clazz, ID oldId, ID newId)
ObjectCache
updateId
in interface ObjectCache
public <T> int size(Class<T> clazz)
ObjectCache
size
in interface ObjectCache
public int sizeAll()
ObjectCache
sizeAll
in interface ObjectCache
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |