Class CacheUtil


  • public class CacheUtil
    extends Object
    Encapsulates a group of utility methods for managing and diagnosing the in-memory caches used by the JDBC PL.
    • Field Detail

      • NEWLINE

        protected static final String NEWLINE
    • Constructor Detail

      • CacheUtil

        public CacheUtil()
    • Method Detail

      • dumpCacheContents

        public static String dumpCacheContents​(String cacheName,
                                               ConcurrentHashMap<String,​ConcurrentHashMap<String,​Integer>> mapOfMaps)
        Takes the contents of one of the JDBC PL caches and represents the contents in a format suitable for logging.
        Parameters:
        cacheName - - The name of the JDBC PL cache to be dumped.
        mapOfMaps - - The contents of the multi-datastore cache.
        Returns:
        String - A formatted representation of the cache contents.
      • reportCacheDiscrepancies

        public static String reportCacheDiscrepancies​(String cacheName,
                                                      ConcurrentHashMap<String,​Integer> cachedMap,
                                                      Map<String,​Integer> dbMap)
        Reports on content discrepancies a JDBC PL cache and DB data that backs it.
        Parameters:
        cacheName - - The name of the JDBC PL cache to be examined.
        cachedMap - - The contents of the cache for a single tenantid/datastoreid combination.
        dbMap - - The contents of the DB table that back the passed cachedMap.
        Returns:
        String - A report of the discrepancies between the passed maps.