Package com.ibm.wsspi.cache
Class Cache
- java.lang.Object
- 
- com.ibm.wsspi.cache.Cache
 
- 
 public class Cache extends java.lang.ObjectThis is the underlying cache mechanism that is used by the CacheMonitor. It contains the methods used to inspect and manage the current state of the cache.
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()This method clears everything from the cache, so that it is just like when it was instantiated.voidclearDisk()This method clears everything from the disk cache.java.util.CollectiongetAllDependencyIds()This method returns the dependency IDs for all cache entries in the memory cache.java.util.EnumerationgetAllIds()This method returns the cache IDs for all cache entries from memory cache.java.util.CollectiongetCacheIdsByDependency(java.lang.String dependency)This method returns the cache IDs of the entries in the memory cache specified by the dependency ID.java.util.CollectiongetCacheIdsByTemplate(java.lang.String template)This method returns the cache IDs of the entries in the memory cache specified by the template.CacheStatisticsListenergetCacheStatisticsListener()This method returns an instance of CacheStatisticsListener.longgetCleanupFrequency()This method returns a value for the disk cache cleanup frequency, in minutes.intgetDefaultPriority()This method returns the default priority value as set in the Administrator console GUI/dynacache.xml file.booleangetDelayOffload()This method returns a boolean to indicate whether the disk cache is using buffers for dependency IDs and templates.longgetDelayOffloadDepIdBuckets()This method returns a value for the maximum number of dependency identifier buckets in the disk cache metadata in memory.longgetDelayOffloadEntriesLimit()This method returns a value for the maximum number of cache identifiers that are stored for an individual dependency ID or template in the disk cache metadata in memory.longgetDelayOffloadTemplateBuckets()This method returns a value for the maximum number of template buckets in the disk cache metadata in memory.java.util.CollectiongetDepIdsByRangeDisk(int index, int length)This method returns the dependency IDs found in the disk cache based on specified the index and the length.intgetDepIdsSizeDisk()This method returns the current number of dependency IDs in the disk cache.java.util.CollectiongetDepIdValueDisk(java.lang.Object depId)This method returns the cache IDs of the entries in the disk cache specified by the dependency ID.longgetDiskCacheEntrySizeInMBLimit()This method returns the maximum size of an individual cache entry in megabytes (MB).intgetDiskCacheEvictionPolicy()This method returns the eviction algorithm that the disk cache will use to evict entries once the high threshold is reached.intgetDiskCacheHighThreshold()This method returns the high threshold is expressed in terms of the percentage of the disk cache size in GB or entries.intgetDiskCacheLowThreshold()This method returns the low threshold is expressed in terms of the percentage of the disk cache size in GB or entries.intgetDiskCachePerformanceLevel()This method returns the performance level to tune the performance of the disk cache.longgetDiskCacheSizeInGBLimit()This method returns the maximum number of disk cache size in gigabytes (GB).floatgetDiskCacheSizeInMBs()This method returns the current disk cache size in Megabytes (MB).longgetDiskCacheSizeLimit()This method returns the maximum number of cache entries that are held in disk cache.CacheEntrygetEntry(java.lang.Object cacheId)This method returns an instance of CacheEntry specified cache ID.CacheEntrygetEntryDisk(java.lang.Object cacheId)This method returns the cache entry specified by cache ID from the disk cache.booleangetFlushToDiskOnStop()This method returns a boolean to indicate whether in-memory cached objects are saved to disk when the server stops.java.util.CollectiongetIdsByRangeDisk(int index, int length)This method returns the cache IDs found in the disk cache based on specified the index and the length.intgetIdsSizeDisk()This method returns the current number of cache entries in the disk cache.intgetMaxCacheSizeInMB()This method returns the maximum space on the JVM heap that can be occupied by the cache entries.intgetMaxNumberCacheEntries()This method returns the maximum number of cache entries that are held in memory cache.floatgetMemoryCacheSizeInMB()This method returns the current space on the JVM heap that is occupied by the cache entries.intgetNumberCacheEntries()This method returns the current number of cache entries for this cache instance.booleangetSwapToDisk()This method determines the disk offloaded feature is enabled or not.java.util.CollectiongetTemplatesByRangeDisk(int index, int length)This method returns the templates found in the disk cache based on specified the index and the length.intgetTemplatesSizeDisk()This method returns the current number of templates in the disk cache.java.util.CollectiongetTemplateValueDisk(java.lang.String template)This method returns the cache IDs of the entries in the disk cache specified by the template.voidinvalidateById(java.lang.String id, boolean waitOnInvalidation)This method invalidates in all caches all entries dependent on the specified id.voidinvalidateByTemplate(java.lang.String template, boolean waitOnInvalidation)This method invalidates in all caches all entries dependent on the specified template.voidrefreshEntry(CacheEntry ce)This method moves the specified entry to the end of the LRU queue.
 
- 
- 
- 
Constructor Detail- 
Cachepublic Cache(Cache ci) 
 
- 
 - 
Method Detail- 
refreshEntrypublic void refreshEntry(CacheEntry ce) This method moves the specified entry to the end of the LRU queue.- Parameters:
- ce- The cache entry
 
 - 
getSwapToDiskpublic boolean getSwapToDisk() This method determines the disk offloaded feature is enabled or not.- Returns:
- True if disk offload feature is enabled. False if disk offload is disabled.
 
 - 
getEntryDiskpublic CacheEntry getEntryDisk(java.lang.Object cacheId) This method returns the cache entry specified by cache ID from the disk cache.- Parameters:
- cacheId- the cache ID
- Returns:
- The cache entry. NULL if cache ID does not exist.
 
 - 
clearDiskpublic void clearDisk() This method clears everything from the disk cache.
 - 
getIdsByRangeDiskpublic java.util.Collection getIdsByRangeDisk(int index, int length)This method returns the cache IDs found in the disk cache based on specified the index and the length. If index = 1 or -1, the set might contain "DISKCACHE_MORE" to indicate there are more cache IDs in the disk cache. The caller need to remove DISKCACHE_MORE" from the set before it is being used.- Parameters:
- index- If index = 0, it starts the beginning. If index = 1, it means "next". If Index = -1, it means "previous".
- length- The max number of cache IDs to be read. If length = -1, it reads all cache IDs until the end.
- Returns:
- The collecton of cache IDs.
 
 - 
getTemplatesByRangeDiskpublic java.util.Collection getTemplatesByRangeDisk(int index, int length)This method returns the templates found in the disk cache based on specified the index and the length. If index = 1 or -1, the set might contain "DISKCACHE_MORE" to indicate there are more templates in the disk cache. The caller need to remove DISKCACHE_MORE" from the set before it is being used.- Parameters:
- index- If index = 0, it starts the beginning. If index = 1, it means "next". If Index = -1, it means "previous".
- length- The max number of templates to be read. If length = -1, it reads all templates until the end.
- Returns:
- The collecton of templates.
 
 - 
getCacheStatisticsListenerpublic CacheStatisticsListener getCacheStatisticsListener() This method returns an instance of CacheStatisticsListener.- Returns:
- The instance of CacheStatisticsListener
 
 - 
getEntrypublic CacheEntry getEntry(java.lang.Object cacheId) This method returns an instance of CacheEntry specified cache ID.- Parameters:
- cacheId- the cache ID
- Returns:
- The instance of CacheEntry
 
 - 
invalidateByIdpublic void invalidateById(java.lang.String id, boolean waitOnInvalidation)This method invalidates in all caches all entries dependent on the specified id.- Parameters:
- id- The cache id or data id.
- waitOnInvalidation- True indicates that this method should not return until the invalidations have taken effect on all caches. False indicates that the invalidations will be queued for later batch processing.
 
 - 
invalidateByTemplatepublic void invalidateByTemplate(java.lang.String template, boolean waitOnInvalidation)This method invalidates in all caches all entries dependent on the specified template.- Parameters:
- template- The template name.
- waitOnInvalidation- True indicates that this method should not return until the invalidations have taken effect on all caches. False indicates that the invalidations will be queued for later batch processing.
 
 - 
clearpublic void clear() This method clears everything from the cache, so that it is just like when it was instantiated.
 - 
getAllIdspublic java.util.Enumeration getAllIds() This method returns the cache IDs for all cache entries from memory cache.- Returns:
- The Enumeration of cache ids.
 
 - 
getMaxNumberCacheEntriespublic int getMaxNumberCacheEntries() This method returns the maximum number of cache entries that are held in memory cache.- Returns:
- The maximum of cache entries.
 
 - 
getNumberCacheEntriespublic int getNumberCacheEntries() This method returns the current number of cache entries for this cache instance.- Returns:
- The current number of cache entries.
 
 - 
getMaxCacheSizeInMBpublic int getMaxCacheSizeInMB() This method returns the maximum space on the JVM heap that can be occupied by the cache entries.- Returns:
- The maximum size of cache allowed in terms of JVM heap.
 
 - 
getMemoryCacheSizeInMBpublic float getMemoryCacheSizeInMB() This method returns the current space on the JVM heap that is occupied by the cache entries.- Returns:
- The current size of cache in terms of JVM heap.
 
 - 
getDefaultPrioritypublic int getDefaultPriority() This method returns the default priority value as set in the Administrator console GUI/dynacache.xml file.- Returns:
- The default priority
 
 - 
getAllDependencyIdspublic java.util.Collection getAllDependencyIds() This method returns the dependency IDs for all cache entries in the memory cache.- Returns:
- A Collection of dependency IDs.
 
 - 
getCacheIdsByDependencypublic java.util.Collection getCacheIdsByDependency(java.lang.String dependency) This method returns the cache IDs of the entries in the memory cache specified by the dependency ID.- Parameters:
- dependency- ID for the group of cache IDs.
- Returns:
- A Collection of cache IDs
 
 - 
getCacheIdsByTemplatepublic java.util.Collection getCacheIdsByTemplate(java.lang.String template) This method returns the cache IDs of the entries in the memory cache specified by the template.- Parameters:
- template- for the group of cache IDs.
- Returns:
- A Collection of cache IDs
 
 - 
getTemplatesSizeDiskpublic int getTemplatesSizeDisk() This method returns the current number of templates in the disk cache.- Returns:
- The current number of templates
 
 - 
getTemplateValueDiskpublic java.util.Collection getTemplateValueDisk(java.lang.String template) This method returns the cache IDs of the entries in the disk cache specified by the template.- Parameters:
- template- for the group of cache IDs.
- Returns:
- A Collection of cache IDs
 
 - 
getIdsSizeDiskpublic int getIdsSizeDisk() This method returns the current number of cache entries in the disk cache.- Returns:
- The current number of cache entries
 
 - 
getDepIdsSizeDiskpublic int getDepIdsSizeDisk() This method returns the current number of dependency IDs in the disk cache.- Returns:
- The current number of dependency IDs
 
 - 
getDepIdsByRangeDiskpublic java.util.Collection getDepIdsByRangeDisk(int index, int length)This method returns the dependency IDs found in the disk cache based on specified the index and the length. If index = 1 or -1, the set might contain "DISKCACHE_MORE" to indicate there are more dependency IDs in the disk cache. The caller need to remove DISKCACHE_MORE" from the set before it is being used.- Parameters:
- index- If index = 0, it starts the beginning. If index = 1, it means "next". If Index = -1, it means "previous".
- length- The max number of dependency IDs to be read. If length = -1, it reads all dependency IDs until the end.
- Returns:
- The collecton of dependency IDs.
 
 - 
getDepIdValueDiskpublic java.util.Collection getDepIdValueDisk(java.lang.Object depId) This method returns the cache IDs of the entries in the disk cache specified by the dependency ID.- Parameters:
- depId- for the group of cache IDs.
- Returns:
- A Collection of cache IDs
 
 - 
getDiskCacheSizeLimitpublic long getDiskCacheSizeLimit() This method returns the maximum number of cache entries that are held in disk cache.- Returns:
- The maximum of disk cache entries.
 
 - 
getDiskCacheSizeInGBLimitpublic long getDiskCacheSizeInGBLimit() This method returns the maximum number of disk cache size in gigabytes (GB).- Returns:
- The maximum of disk cache size in GB.
 
 - 
getDiskCacheEntrySizeInMBLimitpublic long getDiskCacheEntrySizeInMBLimit() This method returns the maximum size of an individual cache entry in megabytes (MB). Any cache entry that is larger than this, when evicted from memory, will not be offloaded to disk.- Returns:
- The maximum of disk cache entry size in MB.
 
 - 
getFlushToDiskOnStoppublic boolean getFlushToDiskOnStop() This method returns a boolean to indicate whether in-memory cached objects are saved to disk when the server stops.- Returns:
- boolean flushToDiskOnStop true or false
 
 - 
getDiskCachePerformanceLevelpublic int getDiskCachePerformanceLevel() This method returns the performance level to tune the performance of the disk cache.- Returns:
- Peformance level 0=low 1=balance 2=custom 3=high
 
 - 
getCleanupFrequencypublic long getCleanupFrequency() This method returns a value for the disk cache cleanup frequency, in minutes. If this value is set to 0, the cleanup runs only at midnight. This setting applies only when the Disk Offload Performance Level is low, balanced, or custom. The high performance level does not require disk cleanup, and this value is ignored.- Returns:
- Cleanup frequency in minutes
 
 - 
getDelayOffloadpublic boolean getDelayOffload() This method returns a boolean to indicate whether the disk cache is using buffers for dependency IDs and templates.- Returns:
- boolean delayOffload true or false
 
 - 
getDelayOffloadEntriesLimitpublic long getDelayOffloadEntriesLimit() This method returns a value for the maximum number of cache identifiers that are stored for an individual dependency ID or template in the disk cache metadata in memory. If this limit is exceeded, the information is offloaded to the disk. This setting applies only when the disk offload performance level is custom.- Returns:
- Delay offload entries limit
 
 - 
getDelayOffloadDepIdBucketspublic long getDelayOffloadDepIdBuckets() This method returns a value for the maximum number of dependency identifier buckets in the disk cache metadata in memory. If this limit is exceeded, the information is offloaded to the disk. This setting applies only when the disk cache performance level is custom.- Returns:
- Delay offload dependency id buckets
 
 - 
getDelayOffloadTemplateBucketspublic long getDelayOffloadTemplateBuckets() This method returns a value for the maximum number of template buckets in the disk cache metadata in memory. If this limit is exceeded, the information is offloaded to the disk. This setting applies only when the disk cache performance level is custom.- Returns:
- Delay offload template buckets
 
 - 
getDiskCacheEvictionPolicypublic int getDiskCacheEvictionPolicy() This method returns the eviction algorithm that the disk cache will use to evict entries once the high threshold is reached.- Returns:
- Eviction policy 0=disable 1=random 2:size
 
 - 
getDiskCacheHighThresholdpublic int getDiskCacheHighThreshold() This method returns the high threshold is expressed in terms of the percentage of the disk cache size in GB or entries. The high value is used when limit disk cache size in GB and limit disk cache size in entries are specified.- Returns:
- High threshold in percentage
 
 - 
getDiskCacheLowThresholdpublic int getDiskCacheLowThreshold() This method returns the low threshold is expressed in terms of the percentage of the disk cache size in GB or entries. The lower value is used when limit disk cache size in GB and limit disk cache size in entries are specified.- Returns:
- Low threshold in percentage
 
 - 
getDiskCacheSizeInMBspublic float getDiskCacheSizeInMBs() This method returns the current disk cache size in Megabytes (MB).- Returns:
- current disk cache size in MB
 
 
- 
 
-