public class DefaultFilesCache extends AbstractFilesCache
FilesCache implementation.
This implementation caches every file with no expire or limit. All files and file systems are hard reachable references. This implementation holds a list of file system specific ConcurrentHashMaps in the main cache map.
Cached FileObjects as well as FileSystems are only removed when
clear(FileSystem) is called (i.e. on file system 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()
Constructs a new instance.
|
| 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)
Gets or creates a Map.
|
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 clear(FileSystem filesystem)
FilesCachefilesystem - The FileSystem.public void close()
AbstractVfsComponentclose in interface Closeableclose in interface AutoCloseableclose in interface FilesCacheclose in interface VfsComponentclose in class AbstractVfsComponentpublic FileObject getFile(FileSystem filesystem, FileName name)
FilesCachefilesystem - The FileSystem.name - the nameprotected ConcurrentMap<FileName,FileObject> getOrCreateFilesystemCache(FileSystem fileSystem)
fileSystem - the keypublic void putFile(FileObject file)
FilesCachefile - the filepublic boolean putFileIfAbsent(FileObject file)
FilesCachefile - the filepublic void removeFile(FileSystem filesystem, FileName name)
FilesCachefilesystem - file systemname - file nameCopyright © 2002–2025 The Apache Software Foundation. All rights reserved.