Package | Class | Tree | Deprecated | Index | Help
| Oracle Application Server Java Object Cache API Reference 10g Release 3 (10.1.3) B25712-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.ias.cache
Class Cache

`java.lang.Object
oracle.ias.cache.Cache`

public class Cache
extends java.lang.Object

The Cache class provides APIs for cache administration tasks, such as initialization, termination and monitoring.

Since:
  2.0.0
See Also:
  `CacheAttributes`, `CacheObjectInfo`

Constructor Summary
`Cache()`

Method Summary
`static void` | `close()` marks the cache as " not ready" and shutdown the cache.
`static void` | `destroy()` globally destroys all the objects in the cache system, includes all processes, memory and disk.
`static void` | `destroy(boolean localOnly)` globally destroys all the objects in the cache memory and disk.
`static void` | `dump()` dumps all the objects in cache to the log file.
`static CacheHostInfo[]` | `getActiveHostInfo()` returns an array of CacheHostInfo objects, one for each active member of the cache system
`static CacheAttributes` | `getAttributes()` returns the attributes currently associated with the cache.
`static java.lang.String` | `getCacheAddress()` returns the String representation of the address currently being used by this instance of the cache, or null if the cache is not on the network.
`static oracle.ias.cache.CacheAddress` | `getCacheAddressObject()` returns the Object representation of the address of the current instance of the cache, or null if the cache is not on the network.
`static int` | `getCacheId()` returns the global cache Id in a distributed cache system.
`static CacheLogger` | `getCacheLogger()` Deprecated. As of 10.1.3, replaced by java.util.logging.Logger.getLogger
`static long` | `getCacheSize()` returns an estimate of the number of bytes consumed by objects in the memory cache.
`static java.lang.String` | `getDiskCacheRootPath()` retrieve the current root path for the disk cache
`static java.lang.String` | `getDiskCacheRootPath(java.lang.String namedCache)` retrieve the current root path for the disk cache
`static long` | `getDistributedDiskCacheSize()` returns the number of bytes consumed by objects in the distributed disk cache.
`static long` | `getLocalDiskCacheSize()` returns the number of bytes consumed by objects in the local disk cache.
`static int` | `getObjectCount()` returns the current count of objects in the cache.
`static java.lang.String` | `getVersion()` GetVersion returns the current version of the cache.
`static void` | `init(CacheAttributes attr)` initializes the cache.
`static void` | `invalidate()` globally invalidates all the objects in the cache system, includes all processes, memory and disk.
`static void` | `invalidate(boolean localOnly)` globally invalidates all the objects in the cache memory and disk.
`static boolean` | `isDistributed()` returns true if the cache is currently in distributed mode, that it is distributing updates and invalidates within the site, false if all cache actions are local to the process only.
`static boolean` | `isReady()` returns true if the cache has been initialized, false otherwise.
`static java.util.Enumeration` | `listCacheObjects()` returns an Enumeration of CacheObjectInfo objects describing the objects in all regions in the cache.
`static java.util.Enumeration` | `listCacheObjects(java.lang.String region)` returns an Enumeration of CacheObjectInfo objects describing the objects in specified region in the cache.
`static void` | `open()` reads the configuration files and establishs the Java caching system in the process.
`static void` | `open(java.lang.String configFile)` reads the configuration files and establishs the Java caching system in the process.
`static void` | `resetAttributes(CacheAttributes attr)` allows some cache attributes to be reset while the cache is running.
`static void` | `setLogSeverity(int severity)` sets the log severity of the cache system.
`static void` | `updateStats()` aggregate the statistics for the cache.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Cache

    public Cache()

Method Detail

### open

    public static void open()
                     throws CacheException

  reads the configuration files and establishs the Java caching system in the process. During the initialization, a hash table is created for storing cached objects, the cache management and message receive threads are started, the metadata is loaded from the disk cache and the cache is registered with the group protocol layer if the cache is distributed. This method should only be called once for each process.
  Throws:
    `CacheException` - if the `open()` fails.

### open

    public static void open(java.lang.String configFile)
                     throws CacheException

  reads the configuration files and establishs the Java caching system in the process. During the initialization, a hash table is created for storing cached objects, the cache management and message receive threads are started, the metadata is loaded from the disk cache and the cache is registered with the group protocol layer if the cache is distributed. This method should only be called once for each process.
  Parameters:
    `configFile` - the name of the configuration file to read the configuration information from
  Throws:
    `CacheException` - if the `open()` fails.

### init

    public static void init(CacheAttributes attr)
                     throws CacheException

  initializes the cache. This includes allocating space for metadata and starting service threads. The attributes parameter contains configuration information to initialize the cache system.
  Parameters:
    `attr` - CacheAttributes which has the cache configuration information.
  Throws:
    `CacheException` - if the `init()` fails.
  Since:
    2.0.0

### close

    public static void close()

  marks the cache as " not ready" and shutdown the cache. Marking the cache as "not ready" will prevent any threads from accessing the cache during shutdown. If the cache is distributed, close will unregister with the distributed caching system. Close should be called as part of process termination.
  Since:
    2.0.0

### getAttributes

    public static CacheAttributes getAttributes()
                                         throws CacheNotAvailableException

  returns the attributes currently associated with the cache.
  Returns:
    a CacheAttributes object with all the configuration information.
  Throws:
    `CacheNotAvailableException` - if the cache has not been intialized.
  Since:
    2.0.0

### getObjectCount

    public static int getObjectCount()
                              throws CacheNotAvailableException

  returns the current count of objects in the cache.
  Returns:
    the current count of objects in the cache
  Throws:
    `CacheNotAvailableException` - if the cache has not been intialized.
  Since:
    2.1.1

### getCacheSize

    public static long getCacheSize()
                             throws CacheNotAvailableException

  returns an estimate of the number of bytes consumed by objects in the memory cache. The accuracy of this value depends on the accuracy of the size attribute set by the user for each object in the cache. If the cache configuration parameter "maxSize" has not been set, the cache size is not maintained so this method will always return 0.
  Returns:
    an estimate of the number of bytes consumed by objects in the cache
  Throws:
    `CacheNotAvailableException` - if the cache has not been intialized.
  Since:
    2.1.1

### getLocalDiskCacheSize

    public static long getLocalDiskCacheSize()
                                      throws CacheNotAvailableException

  returns the number of bytes consumed by objects in the local disk cache.

  If the disk cache is not configured, this method will return 0.

  Returns:
    the number of bytes consumed by objects in the local disk cache
  Throws:
    `CacheNotAvailableException` - if the cache has not been intialized.
  Since:
    2.1.1

### getDistributedDiskCacheSize

    public static long getDistributedDiskCacheSize()
                                            throws CacheNotAvailableException

  returns the number of bytes consumed by objects in the distributed disk cache. If the disk cache is not configured or the cache is not distributed, this method will return 0.
  Returns:
    the number of bytes consumed by objects in the distributed disk cache
  Throws:
    `CacheNotAvailableException` - if the cache has not been intialized.
  Since:
    2.1.1

### resetAttributes

    public static void resetAttributes(CacheAttributes attr)
                                throws CacheNotAvailableException

  allows some cache attributes to be reset while the cache is running. The following attributes can be reset: maxObjects, maxSize, diskSize, diskCount, cacheName, autoInit, capacityBuffer, cleanInterval, and logSeverity. Attributes in the CacheAttributes object must be set with set methods. Attributes that are set directly are ignored.
  Parameters:
    `attr` - CacheAttributes which has the cache configuration information.
  Throws:
    `CacheNotAvailableException` - if the cache has not been intialized.
  Since:
    2.1.1

### invalidate

    public static void invalidate()
                           throws CacheException

  globally invalidates all the objects in the cache system, includes all processes, memory and disk.
  Throws:
    `CacheException` - if any cache error occurs
  Since:
    2.0.0

### invalidate

    public static void invalidate(boolean localOnly)
                           throws CacheException

  globally invalidates all the objects in the cache memory and disk.
  Parameters:
    `localOnly` - if true only objects in the local cache are invalidated
  Throws:
    `CacheException` - if any cache error occurs
  Since:
    9.0.4

### destroy

    public static void destroy()
                        throws CacheException

  globally destroys all the objects in the cache system, includes all processes, memory and disk.
  Throws:
    `CacheException` - if any cache error occurs
  Since:
    2.0.0

### destroy

    public static void destroy(boolean localOnly)
                        throws CacheException

  globally destroys all the objects in the cache memory and disk.
  Parameters:
    `localOnly` - if true only objects in the local cache are invalidated
  Throws:
    `CacheException` - if any cache error occurs
  Since:
    9.0.4

### getVersion

    public static java.lang.String getVersion()

  GetVersion returns the current version of the cache.
  Returns:
    the cache version number
  Since:
    2.0.0

### dump

    public static void dump()

  dumps all the objects in cache to the log file.
  Since:
    2.0.0

### isReady

    public static boolean isReady()

  returns true if the cache has been initialized, false otherwise.
  Returns:
    true if the cache has been initialized; false, otherwise.
  Since:
    2.0.0

### isDistributed

    public static boolean isDistributed()

  returns true if the cache is currently in distributed mode, that it is distributing updates and invalidates within the site, false if all cache actions are local to the process only.
  Returns:
    true, if cache is distributed; false, otherwise.
  Since:
    2.0.0

### listCacheObjects

    public static java.util.Enumeration listCacheObjects()

  returns an Enumeration of CacheObjectInfo objects describing the objects in all regions in the cache. CacheObjectInfo will include information such as the object name, the type, what group it is associated with, the reference count, the expiration time if any and the number of accesses.
  Returns:
    Enumeration of CacheObjectInfo.
  Since:
    2.0.0
  See Also:
    `CacheObjectInfo`

### listCacheObjects

    public static java.util.Enumeration listCacheObjects(java.lang.String region)

  returns an Enumeration of CacheObjectInfo objects describing the objects in specified region in the cache. CacheObjectInfo will include information such as the object name, the type, what group it is associated with, the reference count, the expiration time if any and the number of accesses.
  Returns:
    Enumeration of CacheObjectInfo.
  Since:
    2.0.0
  See Also:
    `CacheObjectInfo`

### setLogSeverity

    public static void setLogSeverity(int severity)

  sets the log severity of the cache system. This determines which messages the cache formats and logs into the log file.
  Since:
    2.0.0
  See Also:
    `CacheLogger`

### getCacheId

    public static int getCacheId()

  returns the global cache Id in a distributed cache system. The cache Id for different cache process will be unique at any given moment, however, the cache Id can be reused if one cache process exits, and a new cache process joins the system. For example, a distributed cache system may initially has three cache processes, they have cache id 1, 2, 3 respectively. Then, cache process with cache id 2 exit, and a new cache process joins the distributed cache system, this new cache process will get cache id 2.
  Returns:
    the global unique cache id (>=1) in the distributed cache system or -1 if the cache is local.
  Since:
    2.0.0

### updateStats

    public static void updateStats()

  aggregate the statistics for the cache.

  The statistics for the cache are aggregated as a background task at the interval specified by the "cleanInterval" configuration parameter or by directly calling updateStats. If a cache is already in the process of aggregating statistics, updateStats will block until the aggregation is complete.

  Since:
    9.0.4
  See Also:
    `AggregateStatus`

### getCacheAddress

    public static java.lang.String getCacheAddress()

  returns the String representation of the address currently being used by this instance of the cache, or null if the cache is not on the network.
  Returns:
    the address of the current instance of the cache or null if the cache is local.
  Since:
    2.0.0

### getCacheAddressObject

    public static oracle.ias.cache.CacheAddress getCacheAddressObject()
                                                               throws CacheException

  returns the Object representation of the address of the current instance of the cache, or null if the cache is not on the network.
  Returns:
    the address of the current instance of the cache or null if the cache is local.
  Throws:
    `CacheException`
  Since:
    9.0.4

### getActiveHostInfo

    public static CacheHostInfo[] getActiveHostInfo()
                                             throws CacheException

  returns an array of CacheHostInfo objects, one for each active member of the cache system
  Returns:
    an array of CacheHostInfo objects, one for each active member of the cache system
  Throws:
    `CacheException`
  Since:
    9.0.4

### getDiskCacheRootPath

    public static java.lang.String getDiskCacheRootPath()
                                                 throws CacheException

  retrieve the current root path for the disk cache
  Returns:
    the root path for the disk cache or an empty string if no disk cache is configured
  Throws:
    `CacheException`
  Since:
    10.1.3

### getDiskCacheRootPath

    public static java.lang.String getDiskCacheRootPath(java.lang.String namedCache)
                                                 throws CacheException

  retrieve the current root path for the disk cache
  Parameters:
    `namedCache` - the name identifying the named cached the disk cache is associated with
  Returns:
    the root path for the disk cache or an empty string if no disk cache is configured
  Throws:
    `CacheException`
  Since:
    10.1.3

### getCacheLogger

    public static CacheLogger getCacheLogger()

  Deprecated. As of 10.1.3, replaced by java.util.logging.Logger.getLogger
  returns a reference to the CacheLogger currently being used by the cache

Package | Class | Tree | Deprecated | Index | Help
| Oracle Application Server Java Object Cache API Reference 10g Release 3 (10.1.3) B25712-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004, 2005, Oracle. All rights reserved.