thredds.filesystem
Class CacheManager

java.lang.Object
  extended by thredds.filesystem.CacheManager

@ThreadSafe
public class CacheManager
extends Object

Handles caching using ehcache. Must be thread safe. Uses ehcache underneath.

Since:
Mar 21, 2009
Author:
caron

Constructor Summary
CacheManager(String cacheName)
           
 
Method Summary
 void add(Serializable path, Serializable value)
           
 void close()
           
 CacheDirectory get(String path, boolean recheck)
          Get a CacheDirectory from the path.
static net.sf.ehcache.CacheManager getEhcache()
           
static void main(String[] args)
           
static void makeReadOnlyCacheManager(String cacheDir, String cacheName)
           
static void makeStandardCacheManager(String configFile, String cacheDir)
           
static void makeTestCacheManager(String cacheDir)
           
 void populateDirs(String root)
           
 void populateDirsProto(String root)
           
 void populateFiles(String root)
           
 void populateFilesProto(String root)
           
static String show(String cacheName)
           
 void showKeys()
           
static void shutdown()
           
 void stats()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheManager

public CacheManager(String cacheName)
Method Detail

getEhcache

public static net.sf.ehcache.CacheManager getEhcache()

makeStandardCacheManager

public static void makeStandardCacheManager(String configFile,
                                            String cacheDir)
                                     throws IOException
Throws:
IOException

makeTestCacheManager

public static void makeTestCacheManager(String cacheDir)

makeReadOnlyCacheManager

public static void makeReadOnlyCacheManager(String cacheDir,
                                            String cacheName)

shutdown

public static void shutdown()

add

public void add(Serializable path,
                Serializable value)

show

public static String show(String cacheName)

get

public CacheDirectory get(String path,
                          boolean recheck)
Get a CacheDirectory from the path. If not in cache, read OS and put in cache.

Parameters:
path - file path
recheck - if true, check that directory hasnt changed, otherwise ok to use cached element without chcking
Returns:
CacheDirectory

close

public void close()

showKeys

public void showKeys()

stats

public void stats()

populateFiles

public void populateFiles(String root)

populateFilesProto

public void populateFilesProto(String root)

populateDirs

public void populateDirs(String root)

populateDirsProto

public void populateDirsProto(String root)

main

public static void main(String[] args)
                 throws IOException
Throws:
IOException


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.