public class FileCache<T extends FileCache.Cacheable>
extends java.lang.Object
FileCache.ItemCreator
interface is used to create cacheable itemsModifier and Type | Class and Description |
---|---|
static interface |
FileCache.Cacheable
Cacheable item for FileCache.
|
static interface |
FileCache.Expiration<T>
Determines whether a cached item has expired
|
static interface |
FileCache.Expireable
Allows expire method to be called for a cached item when it is expired from the cache
|
static interface |
FileCache.ItemCreator<T>
Creates an item to store in the cache
|
static class |
FileCache.LastModifiedExpiration<T>
Expires items if the lastModified of the file is greater than the cached time for the item.
|
Constructor and Description |
---|
FileCache()
Use the
FileCache.LastModifiedExpiration expiration policy by default. |
FileCache(FileCache.Expiration<T> expiration)
Use a specific expiration policy
|
Modifier and Type | Method and Description |
---|---|
T |
get(java.io.File file,
FileCache.ItemCreator<T> creator)
Get entry for a file, and use the creator if necessary to create it.
|
void |
remove(java.io.File file)
Remove entry for a file.
|
public FileCache()
FileCache.LastModifiedExpiration
expiration policy by default.public FileCache(FileCache.Expiration<T> expiration)
expiration
- policypublic void remove(java.io.File file)
file
- filepublic T get(java.io.File file, FileCache.ItemCreator<T> creator)
FileCache.Expireable
then the FileCache.Expireable.expire()
method will be called on it.file
- the iflecreator
- the item creator