org.benow.web.cache
Class CacheDirectoryManager
java.lang.Object
org.benow.web.cache.CacheDirectoryManager
public class CacheDirectoryManager
- extends java.lang.Object
A cache directory. Files are added to the cache directory and associated with
one or more other file dependencies. If a dependency changes, the cache file
is invalidated.
The manager handles the modification registration and invalidation, as well
as persistence and integrity across reboots.
Note: there is no handling of per-user content or security.
- Author:
- andy
|
Method Summary |
CacheEntry |
addMonitor(java.io.File dep,
java.io.File cacheFile)
Creates a new entry, where the given dep (which must exist) is
a dependency of the given depOf. |
CacheEntry |
addMonitor(java.net.URL currURL,
java.io.File cacheFile)
Creates an entry for the given URL. |
boolean |
invalidate(java.io.File dep)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CacheDirectoryManager
public CacheDirectoryManager(java.io.File cacheDir)
addMonitor
public CacheEntry addMonitor(java.io.File dep,
java.io.File cacheFile)
- Creates a new entry, where the given dep (which must exist) is
a dependency of the given depOf. If the dep changes, the depOf
is removed. This can be called several times with the same dep
and other depOfs. The returned CacheEntry contains info about the
current cache state.
- Parameters:
dep - cacheFiles -
- Returns:
addMonitor
public CacheEntry addMonitor(java.net.URL currURL,
java.io.File cacheFile)
- Creates an entry for the given URL. The url must either be to a local file
or to a jar. The jar or file is monitored for changes. If the url is invalid,
null is returned.
- Parameters:
currURL - cacheFile -
invalidate
public boolean invalidate(java.io.File dep)