Package org.compiere.util
Class CacheMgt
- java.lang.Object
-
- org.compiere.util.CacheMgt
-
public class CacheMgt extends Object
Adempiere Cache Management- Version:
- $Id: CacheMgt.java,v 1.2 2006/07/30 00:54:35 jjanke Exp $
- Author:
- Jorg Janke
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_SIZEDefault maximum cache size
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CacheMgtget()Get Cache ManagementList<CacheInfo>getCacheInfos()intgetElementCount()Total Cached ElementsCacheInterface[]getInstancesAsArray()protected voidlocalNewRecord(String tableName, int Record_ID)Reset local CachevoidnewRecord(String tableName, int recordId)<K,V>
Map<K,V>register(CCache<K,V> instance, boolean distributed)Create Cache Instanceintreset()do a cluster wide cache resetintreset(String tableName)do a cluster wide cache reset for tableNameintreset(String tableName, int Record_ID)do a cluster wide cache reset for tableName with recordId keyintresetLocalCache()Reset local Cacheprotected intresetLocalCache(String tableName, int Record_ID)Reset local CacheStringtoString()String RepresentationStringtoStringX()Extended String Representationbooleanunregister(CacheInterface instance)Un-Register Cache Instance
-
-
-
Method Detail
-
get
public static CacheMgt get()
Get Cache Management- Returns:
- Cache Manager
-
register
public <K,V> Map<K,V> register(CCache<K,V> instance, boolean distributed)
Create Cache Instance- Parameters:
instance- Cachedistributed-- Returns:
- true if added
-
unregister
public boolean unregister(CacheInterface instance)
Un-Register Cache Instance- Parameters:
instance- Cache- Returns:
- true if removed
-
reset
public int reset()
do a cluster wide cache reset- Returns:
- number of deleted cache entries
-
reset
public int reset(String tableName)
do a cluster wide cache reset for tableName- Parameters:
tableName- table name- Returns:
- number of deleted cache entries
-
reset
public int reset(String tableName, int Record_ID)
do a cluster wide cache reset for tableName with recordId key- Parameters:
tableName-Record_ID- record id for the cache entries to delete. pass -1 if you don't want to delete cache entries by record id- Returns:
- number of deleted cache entries
-
resetLocalCache
public int resetLocalCache()
Reset local Cache- Returns:
- number of deleted cache entries
-
getInstancesAsArray
public CacheInterface[] getInstancesAsArray()
- Returns:
- cache instances
-
resetLocalCache
protected int resetLocalCache(String tableName, int Record_ID)
Reset local Cache- Parameters:
tableName- table nameRecord_ID- record if applicable or 0 for all- Returns:
- number of deleted cache entries
-
localNewRecord
protected void localNewRecord(String tableName, int Record_ID)
Reset local Cache- Parameters:
tableName- table nameRecord_ID- record if applicable or 0 for all
-
getElementCount
public int getElementCount()
Total Cached Elements- Returns:
- count
-
toString
public String toString()
String Representation
-
toStringX
public String toStringX()
Extended String Representation- Returns:
- info
-
newRecord
public void newRecord(String tableName, int recordId)
-
-