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, setLogger
public LRUFilesCache()
public LRUFilesCache(int lruSize)
lruSize
- the LRU sizepublic void clear(FileSystem filesystem)
FilesCache
filesystem
- The FileSystem.public void close()
AbstractVfsComponent
close
in interface Closeable
close
in interface AutoCloseable
close
in interface FilesCache
close
in interface VfsComponent
close
in class AbstractVfsComponent
public FileObject getFile(FileSystem filesystem, FileName name)
FilesCache
filesystem
- The FileSystem.name
- the nameprotected Map<FileName,FileObject> getOrCreateFilesystemCache(FileSystem fileSystem)
fileSystem
- the keypublic void putFile(FileObject file)
FilesCache
file
- the filepublic boolean putFileIfAbsent(FileObject file)
FilesCache
file
- the filepublic void removeFile(FileSystem filesystem, FileName name)
FilesCache
filesystem
- file systemname
- file namepublic void touchFile(FileObject file)
AbstractFilesCache
touchFile
in class AbstractFilesCache
file
- touch this file.Copyright © 2002–2025 The Apache Software Foundation. All rights reserved.