Class CacheMgt

java.lang.Object
org.compiere.util.CacheMgt

public class CacheMgt extends Object
iDempiere global Cache Manager
Version:
$Id: CacheMgt.java,v 1.2 2006/07/30 00:54:35 jjanke Exp $
Author:
Jorg Janke
  • Field Details

    • MAX_SIZE

      public static int MAX_SIZE
      Default maximum cache size
  • Method Details

    • get

      public static CacheMgt get()
      Get global Cache Manager
      Returns:
      Cache Manager
    • register

      public <K, V> Map<K,V> register(CCache<K,V> instance, boolean distributed)
      Register new CCache Instance.
      This is use by CCache and developer usually shouldn't call this directly.
      Parameters:
      instance - Cache
      distributed -
      Returns:
      map for CCache
    • 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()
      Get cache instances
      Returns:
      cache instances
    • resetLocalCache

      protected int resetLocalCache(String tableName, int Record_ID)
      Reset local Cache
      Parameters:
      tableName - table name
      Record_ID - record if applicable or 0 for all
      Returns:
      number of deleted cache entries
    • localNewRecord

      protected void localNewRecord(String tableName, int Record_ID)
      New record notification for local cache instances
      Parameters:
      tableName - table name
      Record_ID - record if applicable or 0 for all
    • getElementCount

      public int getElementCount()
      Get Total Cached Elements
      Returns:
      total cache element count
    • toString

      public String toString()
      String Representation
      Overrides:
      toString in class Object
      Returns:
      info
    • toStringX

      public String toStringX()
      Extended String Representation
      Returns:
      info
    • newRecord

      public void newRecord(String tableName, int recordId)
      New record notification
      Parameters:
      tableName -
      recordId -
    • getCacheInfos

      public List<CacheInfo> getCacheInfos()
      Get info for cache instances
      Returns:
      info for cache instances
    • hasCache

      public boolean hasCache(String tableName)
      Is there a cache instance for this table name?
      Parameters:
      tableName -
      Returns:
      boolean
    • suspendTableCacheReset

      public void suspendTableCacheReset(String tableName)
      Suspend cache reset operations for tableName (usually to improve performance for batch operations).
      Caller must call resumeTableCacheReset(String) later to clear the suspend cache reset flag.
      Parameters:
      tableName -
    • resumeTableCacheReset

      public void resumeTableCacheReset(String tableName)
      Clear suspend cache reset flag for tableName
      Parameters:
      tableName -