public class DefaultFilesCache extends AbstractFilesCache
FilesCache implementation.
This implementation caches every file with no expire or limit. All files and filesystems are hard reachable references. This implementation holds a list of filesystem specific ConcurrentHashMaps in the main cache map.
Cached FileObjects as well as FileSystems
are only removed when clear(FileSystem) is called (i.e. on filesystem close).
When the used FileSystemManager is closed,
it will also close this cache (which frees all entries).
Despite its name, this is not the fallback implementation used by
DefaultFileSystemManager#init()
anymore.
| Constructor and Description |
|---|
DefaultFilesCache() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear(FileSystem filesystem)
Purges the entries corresponding to the FileSystem.
|
void |
close()
Closes the provider.
|
FileObject |
getFile(FileSystem filesystem,
FileName name)
Retrieves a FileObject from the cache by name.
|
protected ConcurrentMap<FileName,FileObject> |
getOrCreateFilesystemCache(FileSystem filesystem) |
void |
putFile(FileObject file)
Adds a FileObject to the cache.
|
boolean |
putFileIfAbsent(FileObject file)
Adds a FileObject to the cache if it isn't already present.
|
void |
removeFile(FileSystem filesystem,
FileName name)
Removes a file from cache.
|
touchFilegetContext, getLogger, init, setContext, setLoggerpublic void putFile(FileObject file)
FilesCachefile - the filepublic boolean putFileIfAbsent(FileObject file)
FilesCachefile - the filepublic FileObject getFile(FileSystem filesystem, FileName name)
FilesCachefilesystem - The FileSystem.name - the namepublic void clear(FileSystem filesystem)
FilesCachefilesystem - The FileSystem.protected ConcurrentMap<FileName,FileObject> getOrCreateFilesystemCache(FileSystem filesystem)
public void close()
AbstractVfsComponentclose in interface FilesCacheclose in interface VfsComponentclose in class AbstractVfsComponentpublic void removeFile(FileSystem filesystem, FileName name)
FilesCachefilesystem - filesystemname - filenameCopyright © 2002–2016 The Apache Software Foundation. All rights reserved.