public class LRUFilesCache extends AbstractFilesCache
LRUMap.
The default constructor uses a LRU size of 100 per file system.
| Constructor and Description |
|---|
LRUFilesCache()
Constructs a new instance.
|
LRUFilesCache(int lruSize)
Constructs a new instance with the desired LRU size.
|
| 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 Map<FileName,FileObject> |
getOrCreateFilesystemCache(FileSystem fileSystem)
Gets or creates a new 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.
|
void |
touchFile(FileObject file)
Default implementation is a NOOP.
|
getContext, getLogger, init, setContext, setLoggerpublic LRUFilesCache()
public LRUFilesCache(int lruSize)
lruSize - the LRU sizepublic 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 Map<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 namepublic void touchFile(FileObject file)
AbstractFilesCachetouchFile in class AbstractFilesCachefile - touch this file.Copyright © 2002–2025 The Apache Software Foundation. All rights reserved.