|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.unidata.util.CacheManager
public class CacheManager
A static class to manage a set of data caches. Each object could have a cache of data for specific data objects associated with it. This class is a central manager for all the caches. Effectively, it is a Hashtable of Hashtables. The key for the managed cache is the owner of the cached data. The value for the owner key is a Hashtable of cached Data objects.
| Constructor Summary | |
|---|---|
CacheManager()
Default constructor; does nothing. |
|
| Method Summary | |
|---|---|
static void |
addCacheListener(ActionListener a)
Add a listener that gets called when we clear the full cache |
static void |
clearCache()
Clear the cache. |
static Hashtable |
findOrCreate(Object owner)
Find the cache associated with owner and if not there,
create a new cache |
static Object |
get(Object owner,
Object key)
Get the cached object. |
static byte[] |
getCachedFile(String group,
String id)
Get the cached file under the group id if it exists |
static File |
getCachedFilePath(String group,
String id)
Get the cached file under the group id if it exists |
static File |
getCacheGroupDir(String group)
What dir is the cache group in |
static File |
getTmpDir()
get tmp dir |
static File |
getTmpFile(String prefix)
get a tmp file |
static void |
printStats()
Print the statistics for this cache. |
static void |
put(Object owner,
Object key,
Object value)
Put an object in the cache |
static void |
putCachedFile(String group,
String id,
byte[] bytes)
Write the cached file |
static void |
remove(Object owner)
Remove the cache associated with the owner. |
static void |
remove(Object owner,
Object key)
Remove a particular item from the owner's cache. |
static void |
setCacheDir(File dir)
set the cache dir |
static void |
setDoCache(boolean cache)
Set whether we do caching. |
static void |
setMaxFileCacheSize(long maxSize)
Set the max limit on the file cache size |
static void |
setTmpDir(File dir)
Set the tmp dir |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CacheManager()
| Method Detail |
|---|
public static void setDoCache(boolean cache)
cache - Do we do cachingpublic static void setCacheDir(File dir)
dir - cache dirpublic static void setTmpDir(File dir)
dir - tmp dirpublic static File getTmpDir()
public static File getTmpFile(String prefix)
prefix - file prefix
public static File getCacheGroupDir(String group)
group - cache group
public static File getCachedFilePath(String group,
String id)
group - groupid - id
public static byte[] getCachedFile(String group,
String id)
group - groupid - id
public static void setMaxFileCacheSize(long maxSize)
maxSize - Max cache size
public static void putCachedFile(String group,
String id,
byte[] bytes)
group - groupid - idbytes - bytes
public static void put(Object owner,
Object key,
Object value)
owner - owner of the objectkey - key for the cached objectvalue - value for keypublic static void clearCache()
public static void addCacheListener(ActionListener a)
a - cache listenerpublic static Hashtable findOrCreate(Object owner)
owner and if not there,
create a new cache
owner - owner to search for
public static Object get(Object owner,
Object key)
owner - cache ownerkey - key within the cache
public static void remove(Object owner)
owner.
owner - owner of the cache
public static void remove(Object owner,
Object key)
owner - owner of the cachekey - key for object to removepublic static void printStats()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||