|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.fc.cache.CacheTable
Maintains a configurable set of Cache
instances
for a set of requestor objects. Application context entries are used
to configure what specific cache instance is used for a given object.
Each CacheTable
is constructed with a name, which must map
to a set of application context entries as follows:
wt.services/rsc/default/<
The first line above configures the logical name of the cache to be used for the given classname. This name is used when displaying report metrics. The next two lines configure the size of the cache, and the interval after which hit/miss metrics about the cache are printed. The size and report intervals can be assigned defaults by ommiting the cache name prefix. (See below). A report interval of zero will turn off cache reporting.
The following example configures a CacheTable
named "ExampleCache",
with a shared cache for documents and parts and a general cache for other
Iterated
objects. The special cache also overrides the default
report interval settings. To use these entries, a CacheTable instance
would need to be constructed with "ExampleCache" as its name.
wt.services/rsc/default/ExampleCache/null/wt.vc.Iterated/0=General
wt.services/rsc/default/ExampleCache/null/wt.part.WTPart/0=Special
wt.services/rsc/default/ExampleCache/null/wt.doc.WTDocument/0=Special
wt.services/rsc/default/ExampleCache/Size/null/0=200
wt.services/rsc/default/ExampleCache/ReportInterval/null/0=2000
wt.services/rsc/default/ExampleCache/Special.ReportInterval/null/0=1000
Supported API: false
Extendable: false
Field Summary | |
private ApplicationContext |
applicationContext
|
private Map |
classMapping
Maps class names to cache instances. |
private static String |
CLASSNAME
|
private static boolean |
DEBUG
|
private static String |
DOT_REPORT_INTERVAL
|
private static String |
DOT_SIZE
|
protected Object |
lock
|
private static DebugWriter |
LOG
|
String |
name
The name used to look up application context entries for this table. |
private Map |
nameMapping
Maps cache names to cache instances. |
private static String |
REPORT_INTERVAL
|
private static String |
RESOURCE
|
private static String |
SIZE
|
Fields inherited from interface wt.services.applicationcontext.ApplicationContextChild |
APPLICATION_CONTEXT |
Constructor Summary | |
CacheTable(String a_Name)
Constructs a cache table with the given name and a synchronized HashMap
for the class mappings table. |
|
CacheTable(String a_Name,
Map class_mapping)
Supported API: false |
Method Summary | |
void |
clear()
Clears the content of all caches in the table Supported API: false |
protected Cache |
createCache(String cache_name,
int size,
int report_interval)
Instantiates a Cache with the given name, size, and report
interval. |
Cache |
get(String class_name)
Gets a cache for the given class name Supported API: false |
ApplicationContext |
getApplicationContext()
Gets the object for the association that plays role: applicationContext. |
private String |
getCacheName(String class_name)
|
String |
getName()
Gets the value of the attribute: name; The name used to look up application context entries for this table. |
private int |
getReportInterval(String cache_name)
|
private int |
getSize(String cache_name)
|
void |
setApplicationContext(ApplicationContext a_ApplicationContext)
Sets the object for the association that plays role: applicationContext. |
String |
toString()
Prints hit & miss counts for each cache in the table. |
void |
writeContents(Writer w)
Prints the hit and miss counts for each cache in the table, as well as the contents of each cache. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final String RESOURCE
private static final String CLASSNAME
public final String name
private final Map classMapping
private final Map nameMapping
HashMap
because there will be a reasonably small number of cache names configured
via app context
private ApplicationContext applicationContext
private static final String SIZE
private static final String DOT_SIZE
private static final String REPORT_INTERVAL
private static final String DOT_REPORT_INTERVAL
private static final boolean DEBUG
private static final DebugWriter LOG
protected final Object lock
Constructor Detail |
public CacheTable(String a_Name)
HashMap
for the class mappings table. The other
constructor
can be used to specify an alternate Map
implementation.
a_Name
- public CacheTable(String a_Name, Map class_mapping)
a_Name
- class_mapping
- Method Detail |
public final String getName()
public void clear()
public Cache get(String class_name) throws WTException
class_name
-
WTException
public void writeContents(Writer w) throws IOException
w
-
IOException
public String toString()
protected Cache createCache(String cache_name, int size, int report_interval)
Cache
with the given name, size, and report
interval. The default implementation does not use the name parameter.
cache_name
- size
- report_interval
-
public ApplicationContext getApplicationContext()
getApplicationContext
in interface ApplicationContextChild
public void setApplicationContext(ApplicationContext a_ApplicationContext) throws WTPropertyVetoException
setApplicationContext
in interface ApplicationContextChild
a_ApplicationContext
-
WTPropertyVetoException
private String getCacheName(String class_name) throws WTException
WTException
private int getSize(String cache_name) throws WTException
WTException
private int getReportInterval(String cache_name) throws WTException
WTException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |