com.webmethods.caf.wsclient.cache.impl
Class WSCacheManager

java.lang.Object
  extended by com.webmethods.caf.wsclient.cache.impl.WSCacheManager
All Implemented Interfaces:
IWSCacheManager

public class WSCacheManager
extends Object
implements IWSCacheManager

Default implementation of the IWSCacheManager interface


Field Summary
protected  WSClientConfig m_clientConfig
           
 
Constructor Summary
WSCacheManager(WSClientConfig clientConfig)
          Create a new WsCacheManager instance given the specified clientConfig object
 
Method Summary
 void enableCache(boolean enabled)
          Either enable or disable cache
 void flushAllCaches()
          Flush all caches for all interfaces
 void flushCache(IWSProxyFactory factory)
          Flush the cache associated with the specified factory
 WSLruCache getCache(IWSProxyFactory factory)
          Obtain a Cache for a specific proxy factory This is mostly for testing purposes and you should not need to talk to directly to the WSLruCache
 IWSCacheKey getCacheKey(IWSClientSession session, Method method, Object[] args)
          Generate a cache key based on the input information
 Object getCacheValue(IWSCacheKey cacheKey, IWSProxyFactory factory)
          Get the value stored in the cache for a given key
 boolean isEnabled()
          Determine that the cache is enabled or disabled
 void putCacheValue(IWSCacheKey cacheKey, Object value, IWSProxyFactory factory)
          Put the data into the cache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_clientConfig

protected WSClientConfig m_clientConfig
Constructor Detail

WSCacheManager

public WSCacheManager(WSClientConfig clientConfig)
Create a new WsCacheManager instance given the specified clientConfig object

Parameters:
clientConfig - configuration object containing IWSCacheManager configuration options
Method Detail

getCacheKey

public IWSCacheKey getCacheKey(IWSClientSession session,
                               Method method,
                               Object[] args)
Description copied from interface: IWSCacheManager
Generate a cache key based on the input information

Specified by:
getCacheKey in interface IWSCacheManager
Parameters:
session - the current session
method - the target method
args - the params for that method invocation

getCacheValue

public Object getCacheValue(IWSCacheKey cacheKey,
                            IWSProxyFactory factory)
Description copied from interface: IWSCacheManager
Get the value stored in the cache for a given key

Specified by:
getCacheValue in interface IWSCacheManager
Parameters:
cacheKey - see IWSCacheManager.getCacheKey(com.webmethods.caf.wsclient.session.IWSClientSession, java.lang.reflect.Method, Object[])
Returns:
the cached object if found, null otherwise

putCacheValue

public void putCacheValue(IWSCacheKey cacheKey,
                          Object value,
                          IWSProxyFactory factory)
Description copied from interface: IWSCacheManager
Put the data into the cache

Specified by:
putCacheValue in interface IWSCacheManager
Parameters:
cacheKey - the key generated by calls to IWSCacheManager.getCacheKey(com.webmethods.caf.wsclient.session.IWSClientSession, java.lang.reflect.Method, java.lang.Object[])
value - the web service invoke results
factory - the factory that created the proxy that invoked the webservice
See Also:
IWSCacheManager.getCacheKey(com.webmethods.caf.wsclient.session.IWSClientSession, java.lang.reflect.Method, Object[])

getCache

public WSLruCache getCache(IWSProxyFactory factory)
Description copied from interface: IWSCacheManager
Obtain a Cache for a specific proxy factory This is mostly for testing purposes and you should not need to talk to directly to the WSLruCache

Specified by:
getCache in interface IWSCacheManager

enableCache

public void enableCache(boolean enabled)
Description copied from interface: IWSCacheManager
Either enable or disable cache

Specified by:
enableCache in interface IWSCacheManager

isEnabled

public boolean isEnabled()
Description copied from interface: IWSCacheManager
Determine that the cache is enabled or disabled

Specified by:
isEnabled in interface IWSCacheManager
Returns:
true if enabled, false otherwise

flushCache

public void flushCache(IWSProxyFactory factory)
Description copied from interface: IWSCacheManager
Flush the cache associated with the specified factory

Specified by:
flushCache in interface IWSCacheManager

flushAllCaches

public void flushAllCaches()
Description copied from interface: IWSCacheManager
Flush all caches for all interfaces

Specified by:
flushAllCaches in interface IWSCacheManager