com.autonomy.client
Class AciCache

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--com.autonomy.client.AciCache
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class AciCache
extends java.util.Hashtable

AciCache controls the caching of requests within the ACI api. You should use it to specify which ACI action are cached and when/how they are removed from the cache.
It's a singleton class, which gets instantiated internally the first time it is used.

See Also:
Serialized Form

Method Summary
static void addAction(java.lang.String sAction, java.lang.String[] saInvalidates, long lnExpiryMS, java.lang.String sUniqueParameter)
          Details specific cause-effect cases for caching
For example, you might wish to cache the UAServer action 'UserReadAgentList' for speed when reading a user's agent list.
static void setCachingTime(long lCachingTime)
          Set the maximum time for which ACI requests are cached.
static void setLogfileName(java.lang.String sLogfileName)
          Specify the path and name for the caching events logfile.
static void turnLoggingOff()
          Stop logging caching events.
static void turnLoggingOn()
          Start logging caching events.
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

addAction

public static void addAction(java.lang.String sAction,
                             java.lang.String[] saInvalidates,
                             long lnExpiryMS,
                             java.lang.String sUniqueParameter)
Details specific cause-effect cases for caching
For example, you might wish to cache the UAServer action 'UserReadAgentList' for speed when reading a user's agent list.
However, when the command 'agentadd' is sent, you would want to remove all 'UserReadAgentList' actions from the cache,
for that user, so that the updated agent information becomes available.

In this case, you would call
AciCache.addAction("userreadagentlist", null, -1, "username"); AciCache.addAction("agentadd", new String[]{"userreadagentlist"}, 0, "username");

Parameters:
sAction - The action to cache. Case insensitive.
saInvalidates - An array of actions that will be deleted from the cache when an sAction command is sent, if they contain the same value for the sUniqueParameter action parameter as the sAction command does. Set null to not invalidate any other actions.
lnExpiryMS - Maximum length of time that this action is stored in the cache:
  • -1 - Uses the default expiry time for caching, the value that is set by setCachingTime(long)
  • 0 - Do not cache this action
  • <number of milliseconds> - Maximum number of milliseconds to store actions in the cache. This value must be less than the value you set with setCachingTime(long).
sUniqueParameter - When an action containing a saInvalidates array is received, the cache removes all responses that match the conditions:
  • The response's action must a member of saInvalidates
  • If it exists, the value of the parameter sUniqueParameter must be the same in the sAction action and the action to be removed

setCachingTime

public static void setCachingTime(long lCachingTime)
Set the maximum time for which ACI requests are cached.

Parameters:
lCachingTime - the time for which requests are cached in milliseconds. 0 turns off the cache.

setLogfileName

public static void setLogfileName(java.lang.String sLogfileName)
Specify the path and name for the caching events logfile. You can then switch logging on and off using turnLoggingOn and turnLoggingOff.


turnLoggingOn

public static void turnLoggingOn()
Start logging caching events. You must also give a name for the log file using setLogfileName before any logging will occure.


turnLoggingOff

public static void turnLoggingOff()
Stop logging caching events.