atg.commerce.inventory
Class InventoryCacheAdapter

java.lang.Object
  extended by atg.commerce.inventory.InventoryCacheAdapter
All Implemented Interfaces:
CacheAdapter

public class InventoryCacheAdapter
extends java.lang.Object
implements CacheAdapter

An implementation of the CacheAdapter that caches RepositoryItems for the purpose of reading their properties quickly.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Constructor Summary
InventoryCacheAdapter()
           
 
Method Summary
 java.lang.Object getCacheElement(java.lang.Object pKey)
          Gets the object to be stored in the cache with the given key.
 java.lang.Object[] getCacheElements(java.lang.Object[] pKeys)
          Returns the array of elements corresponding to the given array of keys, in the same order as the keys in the input array.
 int getCacheElementSize(java.lang.Object pElement, java.lang.Object pKey)
          Determines the approximate size in bytes of the given cache element.
 int getCacheKeySize(java.lang.Object pKey)
          Determines the approximate size in bytes of the given cache key.
 InventoryManager getUncachedInventoryManager()
          Get property UncachedInventoryManager
 void removeCacheElement(java.lang.Object pElement, java.lang.Object pKey)
          This method is called by the synchronized method Cache.remove to allow the adapter to do any related clean up, if necessary, when an element is removed from the cache.
 void setUncachedInventoryManager(InventoryManager pUncachedInventoryManager)
          Set property UncachedInventoryManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

InventoryCacheAdapter

public InventoryCacheAdapter()
Method Detail

setUncachedInventoryManager

public void setUncachedInventoryManager(InventoryManager pUncachedInventoryManager)
Set property UncachedInventoryManager

Parameters:
pUncachedInventoryManager - new value to set

getUncachedInventoryManager

public InventoryManager getUncachedInventoryManager()
Get property UncachedInventoryManager

Returns:
UncachedInventoryManager

getCacheElement

public java.lang.Object getCacheElement(java.lang.Object pKey)
                                 throws java.lang.Exception
Gets the object to be stored in the cache with the given key.

Specified by:
getCacheElement in interface CacheAdapter
Returns:
an instanceof CachedInventoryInfo
Throws:
java.lang.Exception - if some form of exception occurs while attempting to retrieve the element (e.g., SQLException). Since the type of exceptions possible depend upon the implementation of the adapter, the interface allows for generic exceptions.

getCacheElements

public java.lang.Object[] getCacheElements(java.lang.Object[] pKeys)
                                    throws java.lang.Exception
Returns the array of elements corresponding to the given array of keys, in the same order as the keys in the input array. If an element cannot be found for any given key, the value returned for that array element should be null.

Specified by:
getCacheElements in interface CacheAdapter
Throws:
java.lang.Exception - if some form of exception occurs while attempting to retrieve the elements (e.g., SQLException). Since the type of exceptions possible depend upon the implementation of the adapter, the interface allows for generic exceptions.

getCacheKeySize

public int getCacheKeySize(java.lang.Object pKey)
Determines the approximate size in bytes of the given cache key.

Specified by:
getCacheKeySize in interface CacheAdapter

getCacheElementSize

public int getCacheElementSize(java.lang.Object pElement,
                               java.lang.Object pKey)
Determines the approximate size in bytes of the given cache element. The key is passed in as well in case the implementation needs it for any reason.

Specified by:
getCacheElementSize in interface CacheAdapter

removeCacheElement

public void removeCacheElement(java.lang.Object pElement,
                               java.lang.Object pKey)
This method is called by the synchronized method Cache.remove to allow the adapter to do any related clean up, if necessary, when an element is removed from the cache. Most adapters will simply implement this as an empty method.

Specified by:
removeCacheElement in interface CacheAdapter